Hi, sorry, I forgot to mention that I ran this program using g++ under Linux. Andre Holzner wrote: > > Hi, > > Anton Fokin wrote: > > > > Hi rooters, > > > > I am a bit confused with pointer initialization on win32 and VC6.0. > > > > C++ standard says it guarantees that you get zero pointer when you define a > > pointer. > > As far as I know, I doesn't: > > #include <iostream> > > void main() > { > int *x; > cout << x << endl; > > x = NULL; > cout << x << endl; > > } > > this program indeed produces the following output: > > 0xbfffeab8 > (nil) > > So x is essentially random before the first assignment. > The same holds for other simple data types like int. > Only for classes, one of the constructors is called upon declaration > of the variable. > > best regards, > > Andre > > -- > ------------------+---------------------------------- > Andre Holzner | +41 22 76 76750 > Bureau 32 2-C13 | Building 32 > CERN | Office 2-C13 > CH-1211 Geneve 23 | http://wwweth.cern.ch/~holzner/ -- ------------------+---------------------------------- Andre Holzner | +41 22 76 76750 Bureau 32 2-C13 | Building 32 CERN | Office 2-C13 CH-1211 Geneve 23 | http://wwweth.cern.ch/~holzner/
This archive was generated by hypermail 2b29 : Fri Jun 08 2001 - 11:50:57 MEST