This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: High priority bug?


On Wed, Jun 06, 2001 at 01:30:27PM +1200, Ross Smith wrote:
> relevant) may be initialised either at some point before the call to
> main() or at some point before their first use in the same translation
> unit. (See section 3.6.2 of the C++ standard.) No promises are made
> about the order of initialisation between different translation units.

Ok, but as I wrote, this *is* in the same translation unit.  Yet there
is no check here whether or not the object was initialized.

If what happened is allowed then the following program is not garanteed
to work - is that true?

#include <limits>

int const failure = std::numeric_limits<int>::min();

struct A {
  A(void) {
    // use 'failure', ie:
    if (failure == 0)
      raise(3); // core dump
  }
};

A a;


Note that this DOES work, but it is not garanteed to work, is that what
you are saying?

-- 
Carlo Wood <carlo@alinoe.com>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]