Boost logo

Boost :

From: Greg Colvin (gcolvin_at_[hidden])
Date: 1999-08-31 12:30:15

From: Valentin Bonnard <Bonnard.V_at_[hidden]>
> ...
> /users/bonnard/debug_mode.hpp:
> > extern const bool debug_mode = true
> /users/bonnard/debug_mode.cpp:
> > #include "debug_mode.hpp"
> > const bool debug_mode;

I think that, despite the extern, the declaration in debug_mode.hpp is a
definition, because of the initializer:

  3.1 Declarations and definitions [basic.def]

1 A declaration (clause _dcl.dcl_) introduces names into a translation
  unit or redeclares names introduced by previous declarations. A dec-
  laration specifies the interpretation and attributes of these names.

2 A declaration is a definition unless it declares a function without
  specifying the function's body (_dcl.fct.def_), it contains the extern
  specifier (_dcl.stc_) or a linkage-specification1) (_dcl.link_) and
  neither an initializer nor a function-body, it declares a static data
  member in a class declaration (_class.static_), it is a class name
  declaration (_class.name_), or it is a typedef declaration (_dcl.type-
  def_), a using-declaration (_namespace.udecl_), or a using-directive

Boost list run by bdawes at, gregod at, cpdaniel at, john at