Thanks for the info. I didn't know that we were making a distinction between different kinds of variables in the earlier discussion, but I can see how it is important. Probably my Turbo C++ isn't completely ANSI compatible because I seem to remember defining global arrays and upon inspecting them,finding only the portion that I actually set being initialized,the rest containing "random" data. Actually, I just went and tried it,and lo and behold,it IS initializing global arrays to zero. I stand corrected, must be my memory playing tricks on me ;-) Oh, BTW, another C question for the experts: Is this legal ANSI C? #include void main ( void ) { printf ( "Hello!\n" ); { int j; printf ( "Hi!\n" ); }; }; I always thought that extra sets of braces (without starting a new function or a for, while, etc.) were illegal in ANSI C AND that declaring variables after the start of code like this (unless beginning a new function) was illegal. I thought those things were only allowed in C++. HOWEVER, Turbo C++ compiles it fine EVEN with the C++ functionality turned off (should make it a regular C compiler). Can someone please set me straight? Thanks, Sean At 01:45 PM 6/7/99 -0400, you wrote: >For automatic variables, no, but static duration variables, yes. > >ANS X3.159-1989 3.5.7 Initialization > "If an object that has automatic storage duration is not initialized >explicitly, its value is indeterminate. If an object that has static >storage duration is not initialized explicitly, it is initialized >implicitly as if every member that has arithmetic type were assigned 0 and >every member that has pointer type were assigned a null pointer constant." > >It is not unreasonable, IMO, for compilers for small processors to, at >least optionally, waive the implicit initialization of static duration >objects, as it's good style to explicitly initialize any variable upon >whose startup-value the program will depend and initializing a bunch of >locations to zero when it's not necessary can chew up a lot of cycles at >startup that could be put to better use. > > Jim > >James Grosbach >Development Systems >Microchip Technology >james.grosbach@microchip.com > | | Sean Breheny | Amateur Radio Callsign: KA3YXM | Electrical Engineering Student \--------------=---------------- Save lives, please look at http://www.all.org Personal page: http://www.people.cornell.edu/pages/shb7 mailto:shb7@cornell.edu ICQ #: 3329174 ________________________________________________________ NetZero - We believe in a FREE Internet. Shouldn't you? Get your FREE Internet Access and Email at http://www.netzero.net/download/index.html