Boost documentation.

Alex Martelli aleaxit at yahoo.com
Thu Mar 29 13:28:38 CEST 2001


"Jacek Generowicz" <jmg at ecs.soton.ac.uk> wrote in message
news:g0r8zhwynh.fsf at scumbag.ecs.soton.ac.uk...
    [snip]
> OK, i was not initialized to zero here:
>
> >   for ( int i; i<tup.size(); i++ ) {
>
> (But surely this calls the default constructor for int, which should
> initialize it to zero ?)

No: in C++, the 'pseudo' default-constructors of built-in types
(such as int) are only implicitly called in very specific cases
(e.g., static variables -- NOT auto variables, which is what
you have here).  Your C++ compiler was well within its standard
obligations in not initializing i here (it WOULD have been nice
of it to NOTICE it was uninitialized and warn you about it, but
the standard doesn't mandate that warning).


Alex (Brainbench MVP for C++)






More information about the Python-list mailing list