Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gcc linking question




On Nov 3, 2007, at 10:03 AM, mothra wrote:


Excellent. Apple is not a rogue entity, my code is now more compliant,
*and* I now understand how the compiler was handling my old code. Thanks
so much for the help!


It might be worth noting this part of the standard (yes, I was too tired to look at it last night, but not now =), 9.4.2.4 [class.static.data]:

If a static data member is of const integral or const enumeration type, its declaration in the class definition can specify a constant- initializer which shall be an integral constant expression within its scope. The member shall still be defined in a namespace scope if it is used in the program and the namespace scope definition shall not contain an initializer.


So in your example, this should be fine:

// Merp.h
class Merp
{
	// ...
	static const double Thing = 1.0;
};

// Merp.cc
const double Merp::Thing;

That's probably more akin to what you want.

--
Steve Checkoway



Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: gcc linking question (From: mothra <email@hidden>)
 >Re: gcc linking question (From: "Duane Murphy" <email@hidden>)
 >Re: gcc linking question (From: mothra <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.