On Mittwoch, 26. Dezember 2012 13:16:28 CEST, Roney Gomes wrote:
> How do you work with constants? A simple private attribute in the
> class, or perhaps a shared attribute? How such a constant should be
> initialized?
"Where you need them"
local statics (function specific), global statics (you need to cross classes),
private statics - or an enum (providing type more type safety)
Not in a header, if it's an implementation detail. Otherwise there's nothing
wrong about "math_constants.h"
In doubt stash them in a namespace (namespace Constant { static const double Pi
= 3.14, Euler = 0.577; }
Cheers,
Thomas
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<