This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: problem with macro expansion in GCC
- To: 'Puneet Singhal' <puneet at opussoft dot com>, Dhanabal Ekambaram <Dhanabal at Zambeel dot com>, gcc-help at gcc dot gnu dot org
- Subject: RE: problem with macro expansion in GCC
- From: David Korn <dkorn at pixelpower dot com>
- Date: Tue, 6 Feb 2001 18:20:51 -0000
What happens if you try
#define XXX(N) N ## .ptr
or perhaps
#define CAT(a, b) a ## b
#define XXX(N) CAT(N, .ptr)
One or other of those should work. You can't ask macros to concatenate
two strings just by writing them next to each other, you have to use
the pre-processor pasting command ##.
DaveK
--
we are not seats or eyeballs or end users or consumers.
we are human beings - and our reach exceeds your grasp.
deal with it. - cluetrain.org
>-----Original Message-----
>From: Puneet Singhal [mailto:puneet@opussoft.com]
>Sent: 06 February 2001 04:54
>To: Dhanabal Ekambaram; gcc-help@gcc.gnu.org
>Subject: RE: problem with macro expansion in GCC
>Importance: High
>
>
>I tried it on my machine (solaris sparc 7 and gcc 2.95.2)
>I get " y .ptr" instead of desirable "y.ptr".
>
>Even I cant figure out why?
>
>Puneet
>
>>-----Original Message-----
>>From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org]On
>>Behalf Of Dhanabal Ekambaram
>>Sent: Tuesday, February 06, 2001 8:36 AM
>>To: 'gcc-help@gcc.gnu.org'
>>Subject: problem with macro expansion in GCC
>>
>>
>>Hi,
>>
>>When I use
>>
>>#define XXX(N) N.ptr
>>
>>XXX(y) gets transformed to " y.ptr" instead of "y.ptr".
>>I am not sure why i am getting this leading space in the
>expanded string.
>>
>>Can anybody help me to eliminate this problem?
>>
>>Thanks,
>>dhanabal
>
>
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************