Article View: gnu.gcc.help
Article #42696Re: please help me with directive ##
From: Karen Hensley
Date: Thu, 09 Nov 1995 00:00
Date: Thu, 09 Nov 1995 00:00
48 lines
2216 bytes
2216 bytes
The C FAQ may have some hints for you. Solaris uses the old
pre ANSI it seems.
10.20: I have some old code that tries to construct identifiers with a
macro like
#define Paste(a, b) a/**/b
but it doesn't work any more.
A: It was an undocumented feature of some early preprocessor
implementations (notably John Reiser's) that comments
disappeared entirely and could therefore be used for token
pasting. ANSI affirms (as did K&R1) that comments are replaced
with white space. However, since the need for pasting tokens
was demonstrated and real, ANSI introduced a well-defined token-
pasting operator, ##, which can be used like this:
#define Paste(a, b) a##b
Ugly, ain't it? -Karen
=============================================================================
Karen Hensley Bridgeway Corporation
Manager of Software Development Bridging the Gap in Network Mgt.
My opinions may not be Bridgeway's. (206) 881-4270
On 9 Nov 1995, Suwanto Suwanto wrote:
> I am trying to port a program that is compiled succesfully on Dec Ultrix,
> but i can't compile it on Solaris. The problem seems to be with the
> following directive:
>
> #define CONCAT(f) f##_ptr
>
> it is supposed to append a string '_ptr' at the end of the variable f.
>
> suppose you do CONCAT(head) then the result should be head_ptr
>
> Apparently Solaris and a few other systems don't like this kind of directive.
>
> If you know other directive that does the same thing, please let me know.
> Any help is appreciated.
>
> Thank you,
> Suwanto
>
Technical Details
Message-ID:
<Pine.SUN.3.90.951109140336.16363E-100000@server.bridgeway.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<47tmng$anq@wizard.uark.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,57e7c0d8b71efcb8 X-Google-Attributes: gid11318c,public From: kfh@bridgeway.COM (Karen Hensley) Subject: Re: please help me with directive ## Date: 1995/11/09 Message-ID: <Pine.SUN.3.90.951109140336.16363E-100000@server.bridgeway.com> X-Deja-AN: 119014267 distribution: gnu sender: daemon@cis.ohio-state.edu references: <47tmng$anq@wizard.uark.edu> organization: GNUs Not Usenet newsgroups: gnu.gcc.help