Topic: [comp.lang.c++,comp.std.c++] Why can't I have a namespace within a class?


Author: Jens Kilian <Jens_Kilian@bbn.hp.com>
Date: 1999/02/18
Raw View
> There's one problem with this method.  Builtin variables created as
> local or heap objects are not zero-initialized, whereas STL variables
> are.  So the above does not zero initialize hello::a and hello::b, but
> it does zero initialize world::a and world::b.
>
> I find this dichotomy between builtin variables and STL variables to
> be positively annoying.  IMNSHO, builtin variables should be zero
> initialized.

I disagree. I see a problem in the discrepancy between built-in types and
STL concrete classes like complex<...>, too, but I would be in favor of
removing the initialization to zero in the default constructor.

 void do_something_to(complex<float> &c); // sets c to 42 + 4711i

 complex<float> foo;      // why should this need to be initialized...
 do_something_to(foo);    // ...when it is immediately overwritten?

Greetings,

 Jens.
--
mailto:jjk@acm.org                 phone:+49-7031-14-7698 (HP TELNET 778-7698)
  http://www.bawue.de/~jjk/          fax:+49-7031-14-7351
PGP:       06 04 1C 35 7B DC 1F 26 As the air to a bird, or the sea to a fish,
0x555DA8B5 BB A2 F0 66 77 75 E1 08 so is contempt to the contemptible. [Blake]


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]