Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #1872

Re: Preprocessing ##

From Kaz Kylheku <686-678-9105@kylheku.com>
Newsgroups comp.compilers
Subject Re: Preprocessing ##
Date 2017-05-15 13:41 +0000
Organization Aioe.org NNTP Server
Message-ID <17-05-005@comp.compilers> (permalink)
References <17-05-003@comp.compilers>

Show all headers | View raw


On 2017-05-13, Hans-Peter Diettrich <DrDiettrich1@netscape.net> wrote:
> How is the C preprocessor assumed to handle the ## concatenation operator?
>
> In the Windows headers I found macros like
>    #define foo(x) bar(##baz(x))
> where an expansion into ... (baz ... doesn't make sense, because "(baz"
> is not a valid preprocessor token. Can somebody explain the meaning and
> handling of such constructs?

According to ISO C, if the result of the ## operator is an invalid
token, the behavior is undefined.

If you're making a compiler which will have to handle the unmodified
header files from Microsoft platform development kits for Windows, you
have little choice but to implement compatible preprocessing, which
handles whatever constructs occur, in the same way.

In other words, the actual meaning here is "whatever Visual C does".
[Ugh.  But I have to agree. -John]

Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Preprocessing ## Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2017-05-13 08:49 +0200
  Re: Preprocessing ## Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2017-05-15 11:28 +0200
  Re: Preprocessing ## Kaz Kylheku <686-678-9105@kylheku.com> - 2017-05-15 13:41 +0000
  Re: Preprocessing ## George Neuner <gneuner2@comcast.net> - 2017-05-15 11:31 -0400
    Re: Preprocessing ## Hans-Peter Diettrich <DrDiettrich1@aol.com.dmarc.email> - 2017-06-02 08:04 +0200

csiph-web