| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#21
| |||
| |||
| Ben Bacarisse wrote: > Ian Collins <ian-news@hotmail.com> writes: > >> Ben Bacarisse wrote: >>> Jerry Coffin <jcoffin@taeus.com> writes: >>>>> Most c++ compiler support C99 unless you disable it in the command line. >>>> Really? All the C++ compilers I have handy seem to reject the following >>>> perfectly legal bit of C99 code: >>>> >>>> union { >>>> char birthday[9]; >>>> int age; >>>> float weight; >>>> } people = { .age = 14 }; >>>> >>> Recent versions of gcc accept it. >>> >> gcc also accepts VLAs, but I doubt any other C++ compiler would. > > I mean gcc accepts it when invoked with '-std=c99'. Jerry Coffin said > it did not. I am reporting that at least some recent versions do (as > they must if they want to compile C99). > > For the record, the same gcc correctly rejects (or at least diagnoses) > VLAs when invoked as a conforming C++ compiler. The presence of a > default mixed mode where a compiler accept some odd half-language plus > extensions is unfortunate but common. > That (gcc correctly rejects VLAs in C++ mode) is good. One of my worst poring form gcc to standard C++ nightmares was scores of gcc VLAs. -- Ian Collins. |
|
#22
| |||
| |||
| In article <878wu5ieu0.fsf@bsb.me.uk>, ben.usenet@bsb.me.uk says... [ ... ] > Recent versions of gcc accept it. I'm glad to hear that. What I was using isn't exactly current, but it's not terribly old either -- it's good to hear that they're apparently making a real attempt at C99 compliance (finally...) -- Later, Jerry. The universe is a figment of its own imagination. |
|
#23
| |||
| |||
| Jerry Coffin a écrit : > In article <48c0dbfe$0$17346$426a74cc@news.free.fr>, > michael.doubez@free.fr says... > > [ ... ] > >> Most c++ compiler support C99 unless you disable it in the command line. > > Really? All the C++ compilers I have handy seem to reject the following > perfectly legal bit of C99 code: > > union { > char birthday[9]; > int age; > float weight; > } people = { .age = 14 }; > True. I have overly generalized. I was thinking of VLAs which tends to creep in so often. This code is however accepted by my IAR c++ compiler. More compliant c++ compiler will hopefully reject this code. But I guess one could tweak them into accepting it. -- Michael |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.