Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Problem with GCC 3.3 and pasting in macros

Thread Tools

Problem with GCC 3.3 and pasting in macros

Dan Pop
Posts: n/a
In <bdcgn9$6jh$(E-Mail Removed)> Joona I Palaste <(E-Mail Removed)> writes:

>If the code compiles cleanly with both ## in place in GCC 2.95, then
>GCC 2.95 is broken, although I think now Dan Pop will chime in and
>accuse me of not engaging my brain.

Your guess is right! Undefined behaviour requires no diagnostic and we
have a case of undefined behaviour here. Both versions of gcc are doing
the right thing.

>I don't think you even *can* pass variable arguments to a macro in
>standard C. If you can in GCC, then it's a GCC feature, not a C feature.

Please engage your brain *now* and explain us where are the variable
arguments in OP's examples. AFAICT, the macro was defined with three
parameters and invoked with three arguments, a perfect match.

BTW, C99 supports macros with a variable argument list.

Dan Pop
DESY Zeuthen, RZ group
Email: Removed)
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Macros : error: pasting does not give a valid preprocessing token girishk.k4 C Programming 0 03-23-2013 12:12 PM
Re: String literals in macros that use token pasting Ben Bacarisse C Programming 2 08-04-2009 06:13 PM
Explanation of macros; Haskell macros Python 80 11-07-2003 02:22 AM
Re: Explanation of macros; Haskell macros Python 5 11-01-2003 01:09 AM
Re: Explanation of macros; Haskell macros Python 1 10-07-2003 04:07 PM