LWN.net Logo

C89 includes blocks you know...

C89 includes blocks you know...

Posted Jun 11, 2008 11:31 UTC (Wed) by ballombe (subscriber, #9523)
In reply to: C89 includes blocks you know... by nix
Parent article: Implications of pure and constant functions

I cannot provide you with one, but info gcc document this extension seems to imply the C89 restriction only apply to aggregate initializers.

5.18 Non-Constant Initializers
==============================

As in standard C++ and ISO C99, the elements of an aggregate
initializer for an automatic variable are not required to be constant
expressions in GNU C.  Here is an example of an initializer with
run-time varying elements:

     foo (float f, float g)
     {
       float beat_freqs[2] = { f-g, f+g };
       /* ... */
     }


(Log in to post comments)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds