Re: A little bit of C fun...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 22 Oct 2008, me22 wrote:

On Wed, Oct 22, 2008 at 15:37, John Carter <john.carter@xxxxxxxxxx> wrote:
On Wed, 22 Oct 2008, me22 wrote:

Use the preprocessor.  Otherwise you can't get braces inside parens.

Nope. I didn't use preprocessor. But warped kudos to you for thinking
of it.


Say, what about -std=gnu++0x?  Then the braces can be an initializer list...


I compiled this with gcc 3 and gcc 4 using -std=c89 and -std=c99 with
-Wall and -W.

gcc-2.95 failed
a(&(b){c}) but passed
  a((b){c})


-W warns about a(&(b){}) but that is one of those cases where -W
 warns about a potential omission in a legal operation.

And yes, you're on the right track now, the braces are an initializer list.



John Carter                             Phone : (64)(3) 358 6639
Tait Electronics                        Fax   : (64)(3) 359 4632
PO Box 1645 Christchurch                Email : john.carter@xxxxxxxxxx
New Zealand


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux