> Are you sure about this?  The code has lots of instances of statements
> like this one:
> 
>     static int        maximum_word_length = config.Value("maximum_word_length", 12);
> 
> which seem to work fine.  My understanding is the compiler will genrate
> code to initialise these once (and only once) at run time, when the
> function is first called.  If it works for int, why not for char *,
> or String?  Can anyone else with more C++ experience than me explain
> what really goes on behind the scenes with constructs like above?
> Am I out to lunch on this?  Is it "implementation-dependent"?

OOps, 
sorry you're right, my mistake
but there was a compile error (I have gcc 2.95.1 which
is picky on some issues) because of a missing const.

I tend to avoid statics so I forgot to think twice :-)

I checked with a small test program, you're right static works.
My C++ reference book (STROUSTRUP) confirms that
static variables are initialized the first time the
program *reaches* them ...

cheers,


Marcel.

 

    ----------------------

    Marcel Bosc

    ECILA
    100 av. du Gal Leclerc
    93500 Pantin  - France
    Tel:  33 1 56 96 10 85

------------------------------------
To unsubscribe from the htdig3-dev mailing list, send a message to
[EMAIL PROTECTED] containing the single word "unsubscribe" in
the SUBJECT of the message.

Reply via email to