|
Boost : |
From: Kevlin Henney (Kevlin.Henney_at_[hidden])
Date: 1999-08-31 11:56:25
Greg Colvin wrote:
[...]
No, we do not wish to, but we may have to. Although "impose a single
development style" seems a harsh characterization of "define NDEBUG, or
not, in accordance with the standard".
It's more a case of "define NDEBUG everywhere, or don't", which is not a
requirement of the standard, where NDEBUG is dependent on translation
unit (or rather "current lexical definition", but I'm referring to how
it's commonly used).
Does anyone know how C99, which now has inline functions, handles this
problem, if it does?
Differently. To retain backward linker compatibility (sic), it requires
that there is a unique point of definition in some translation unit. To
accommodate C++ compatibility, the definition looks like a declaration:
same as the for the function, except that it is explicitly declared
extern (or simply omits inline). There also appear to be other
differences in the definition models, such that one might still end up
with multiple static definitions, but the extern one will always be used
for the address. A conforming program will not depend on which
definition is used, and this is classified as unspecified rather than
undefined behaviour.
I'm not anticipating a change in the standard, just some compiler magic.
Perhaps that is too much to ask.
I don't think compiler magic is too much to ask, but consistent and
portable magic might be :-(
[Aside: a revealing typo on first typing the last sentence: "potable"
rather than "portable" :->]
Kevlin
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk