Const sucks
Janice Caron
caron800 at googlemail.com
Tue Sep 11 10:56:07 PDT 2007
On 9/11/07, Janice Caron <caron800 at googlemail.com> wrote:
> What's wrong with:
>
> class C
> {
> const int X = 42; /* not stored; address may not be taken */
> static int Y = 42; /* consumes memory; address may be taken */
> }
Of course, I actually meant:
class C
{
const int X = 42; /* not stored; address may not be taken */
static const int Y = 42; /* consumes memory; address may be taken */
}
The point being that for constant data to consume memory
*per-class-instance* is silly.
More information about the Digitalmars-d
mailing list