Re: C++ warnings
Re: C++ warnings
- Subject: Re: C++ warnings
- From: Justin Walker <email@hidden>
- Date: Wed, 13 Apr 2005 22:59:18 -0700
On Apr 13, 2005, at 22:05, Andrew White wrote:
Justin Walker wrote:
Hi, all,
hecke/msymbols.h:109: warning: `MSymbols::chi' will be initialized
after
hecke/msymbols.h:108: warning: `int MSymbols::k'
The lines in question are in a class definition (MSymbols) in a .h
file, and look like
108: int k, N ; // weight, level
109: Character chi ; // character
110: bool do_save ;
C++ recommends that initialiser lists (in your constructor) initialise
data members in the same order as they appear in your class / struct.
Are you perhaps ...?
MSymbols:MSymbols (const Character & p1, int p2, bool p3)
: chi (p1), k(p2), do_save (p3)
Ayup...that seems to be it.
As noted in my original post, I have this:
Could it have to do with this (appearing first in the class
definition)?
MSymbols (const Character& chi, int k=2, bool save=false) ;
The "obvious" fix isn't (I gather default values can be given only at
the end of an arg list), so I reversed the order of declaration in the
class. Piece of cake.
Is there a site or a source for tips like this? I have a few more
warning messages weighing heavily on my conscience.
Thanks for the help!
Regards,
Justin
--
Justin C. Walker, Curmudgeon-At-Large
Institute for General Semantics
--------
If you're not confused,
You're not paying attention
--------
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden