* concatenating with cpp
@ 2001-10-18 14:23 Nikolaos A. Margaritis
0 siblings, 0 replies; 2+ messages in thread
From: Nikolaos A. Margaritis @ 2001-10-18 14:23 UTC (permalink / raw)
To: Alpha Mailing List
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Dear all,
I have a problem with the cpp. Well, I have a definition:
#define DIM 4
then I need the preprocessor to concatenate "SOME_NAME_" with "DIM", ie
I want to it to return SOME_NAME_4 which is a function name.
Thus if I type:
SOME_VALUE_ some_operation{DIM} ()
the compiler should call:
SOME_VALUE_4()
Can this be done? I have read the info for cpp, and I noticed that
prescanning of variables is not done for concatenating strings.
Thanks in advance,
Nikos
- --
Dr. Nikolaos A. Margaritis
Department of Physical Chemistry
National Research Centre for Physical Sciences "Demokritos"
Ag. Paraskevi, Athens 15310, Greece.
Tel: +30(0)1 650 3964
URL: http://mmml.chem.demokritos.gr/~nmargar
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE7zuXw+7yOA19c97kRAuoTAJ9e1M8iXQuKDokOIXSMRvmyP62aggCdEB6E
sA7VbrcZBHrRX/d/Idyskvk=
=vXqi
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: concatenating with cpp
@ 2001-10-18 15:59 Chris Eleveld (Sector 7 Group)
0 siblings, 0 replies; 2+ messages in thread
From: Chris Eleveld (Sector 7 Group) @ 2001-10-18 15:59 UTC (permalink / raw)
To: axp-list
You want to use ANSI token pasting:
#define PASTE(a, b) a##b
#define DIM 4
PASTE(SOME_NAME_, DIM4)
if using K&R compiler:
#define PASTE(a,b) a/**/b
----- Original Message -----
From: <nmargar@mail.demokritos.gr>
To: "Alpha Mailing List" <axp-list@redhat.com>
Sent: Thursday, October 18, 2001 9:23 AM
Subject: concatenating with cpp
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Dear all,
>
> I have a problem with the cpp. Well, I have a definition:
>
> #define DIM 4
>
> then I need the preprocessor to concatenate "SOME_NAME_" with "DIM", ie
> I want to it to return SOME_NAME_4 which is a function name.
>
> Thus if I type:
>
> SOME_VALUE_ some_operation{DIM} ()
>
> the compiler should call:
>
> SOME_VALUE_4()
>
> Can this be done? I have read the info for cpp, and I noticed that
> prescanning of variables is not done for concatenating strings.
>
> Thanks in advance,
>
> Nikos
> - --
> Dr. Nikolaos A. Margaritis
> Department of Physical Chemistry
> National Research Centre for Physical Sciences "Demokritos"
> Ag. Paraskevi, Athens 15310, Greece.
> Tel: +30(0)1 650 3964
> URL: http://mmml.chem.demokritos.gr/~nmargar
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.6 (GNU/Linux)
> Comment: For info see http://www.gnupg.org
>
> iD8DBQE7zuXw+7yOA19c97kRAuoTAJ9e1M8iXQuKDokOIXSMRvmyP62aggCdEB6E
> sA7VbrcZBHrRX/d/Idyskvk=
> =vXqi
> -----END PGP SIGNATURE-----
>
>
>
> _______________________________________________
> Axp-list mailing list
> Axp-list@redhat.com
> https://listman.redhat.com/mailman/listinfo/axp-list
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-10-18 15:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-10-18 14:23 concatenating with cpp Nikolaos A. Margaritis
-- strict thread matches above, loose matches on Subject: below --
2001-10-18 15:59 Chris Eleveld (Sector 7 Group)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox