Re: [htdig3-dev] G++ Woes (Was: Current CVS is broken)


Torsten Martinsen (tma-p@gatehouse.dk)
Mon, 4 Oct 1999 12:57:20 +0200


> > G++ reports many errors of the form:
> > In file included from ../../htlib/String_fmt.cc:17:
> > ../../htlib/htString.h: In method `char String::operator [] (int) const':
> > ../../htlib/htString.h:225: warning: sorry: semantics of inline function static data `char null' are wrong (you'll wind up with multiple copies)
> > ../../htlib/htString.h:225: warning: you can work around this by removing the initializer
>
> I've fixed this by moving the static char null outside
> the inline function. The header has a static char null = '\0' in it and
> therefore will have as many copies of null as there are source files using
> htString. We loose at most 100 bytes. Tolerable ?-)

If the definition is

    const char null = '\0';

it should (according to Standard C++) be equivalent to

    #define null '\0'

(i.e., NO copies will be allocated, as the const will be resolved at compile time).

-Torsten

------------------------------------
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 Mon Oct 04 1999 - 04:15:26 PDT