Re: [htdig3-dev] cleanups in htword, bugfixes in htsearch/Display.cc


Marcel Bosc (bosc@ceic.com)
Tue, 2 Nov 1999 18:20:14 +0100


> 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
htdig3-dev@htdig.org containing the single word "unsubscribe" in
the SUBJECT of the message.



This archive was generated by hypermail 2.0b3 on Tue Nov 02 1999 - 09:30:03 PST