• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: C++ warnings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++ warnings


  • Subject: Re: C++ warnings
  • From: Andrew White <email@hidden>
  • Date: Thu, 14 Apr 2005 15:05:35 +1000


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)
{
	// body of initialiser
}

(Parameter names changed so I don't have to deal with parameter vs member scoping headaches)

In this case, you are initialising chi before k.

--
Andrew White

--------------------------------------------------------------------------
This email and any attachments may be confidential. They may contain legally
privileged information or copyright material. You should not read, copy,
use or disclose them without authorisation. If you are not an intended
recipient, please contact us at once by return email and then delete both
messages. We do not accept liability in connection with computer virus,
data corruption, delay, interruption, unauthorised access or unauthorised
amendment. This notice should not be removed.
_______________________________________________
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


  • Follow-Ups:
    • Re: C++ warnings
      • From: Alexey Proskuryakov <email@hidden>
    • Re: C++ warnings
      • From: Justin Walker <email@hidden>
References: 
 >C++ warnings (From: Justin Walker <email@hidden>)

  • Prev by Date: Re: IOKit and .xcode
  • Next by Date: Re: Post-build execution of scripts/commands?
  • Previous by thread: C++ warnings
  • Next by thread: Re: C++ warnings
  • Index(es):
    • Date
    • Thread