On Sun, 2011-01-23 at 16:50 +0100, ThorstenB wrote:
> On Sun, Jan 23, 2011 at 3:44 PM, Geoff McLane wrote:
> And I am not so sure MSVC even zeros static variables,
> unless specifically set to NULL/0, unlike as suggested
> for gcc, thus say :-
>
> static char * cp;
> void func() {
> if (cp == NULL)
> cp = malloc(val);
> can also be a problem...
>
> It'd still be interesting to know if MSVC really doesn't comply with the rule
> above - this could certainly be a source for several MSVC-specific FG issues
> (just guessing here...).
>
> cheers,
> Thorsten
>
Hi Thorsten,
I do not know if the developers of MS VC tools
make any effort to conform to C99 or not, but
this wiki :-
http://en.wikipedia.org/wiki/C99
categorically states, as of MSVC10 (2010), a
resounding red flagged _NO_!
And there are other cases I know about where
MS has chosen to do its own thing, as far as it
can... ;=))
At the moment do not have access to my machine
with MSVC9 and MSVC10 installed, so can not
immediately check them, but checking MSVC8,
neither __STDC__ nor __STDC_VERSION__ seem
defined by the compiler...
Whereas, in a quick Ubuntu test, I can see gcc
(4.2.4) defines at least __STDC__.
And in some quick test compiles with MSVC8,
several static variable examples I tried all
seemed to be NULL/0, but maybe that more
represents the relative pristine initial
memory state, when I start the machine...
But, like you, I would prefer to see explicit
initializations, and am sure, over the years,
I have seen this static value error now and
again...
And as stated, see it all the time with class
instantiation...
So it seems, good cross-platform code would
make sure _ALL_ are specifically initialized.
Regards,
Geoff.
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel