STL

Started by
11 comments, last by kelaklub 20 years, 3 months ago
Yes, how utterly stupid of me.

Also just Point() {}.

[ Google || Start Here || ACCU || STL || Boost || MSDN || GotW || CUJ || MSVC++ Library Fixes || BarrysWorld || E-Mail Me ]
[ Google || Start Here || ACCU || STL || Boost || MSDN || GotW || CUJ || MSVC++ Library Fixes || BarrysWorld || [email=lektrix@barrysworld.com]E-Mail Me[/email] ]
Advertisement
quote:
Also just Point() {}


Alas, this will not call the default constructors for x,y or z unless Point is static.

And possibly one or two other situations but I would have to look those up :D

*rummages through notes*

Undefined elements of an array, for example int a[10]={1};

int *a1=new int
int *a2=new int()

should also differ, I believe, in the same way (but appear not to on g++) with *a1 = any value and *a2 = 0

It''s a bloody minefield and has caused several bugs ... one of which I found today

quote:
   Point( const tType& X = tType(), const tType& Y = tType(), const tType& Z = tType() )    : x(X), y(Y), z(Z) {} 



Should cope nicely!
quote:
Alas, this will not call the default constructors for x,y or z unless Point is static


"Initialize to 0" instead of "default constructor" for built in types.

This topic is closed to new replies.

Advertisement