[comp.sys.amiga] C++ static members

rokicki@Neon.Stanford.EDU (Tomas G. Rokicki) (12/29/89)

Static members can be made to work with Lattice C++ (there is a section in
the manual on this; you use an option on the compiler to compile the header
*once* keeping the static member, and another option the rest of the time.)
Personally, I don't like this kludge, so I do the equivalent simple thing
instead:

Class.h:

class Class {
   static int foo ;
} ;

I change this to:

class Class {
} ;
extern int _Class_foo ;

and in Class.cp I

int _Class_foo ;

It's portable.  (Note that _Class_foo is in the namespace that is reserved
for the compiler, really, so a different name should be used.)

-tom