[C++] init.c/build_new wrongly implements new-expression
Alexandre Oliva
oliva@dcc.unicamp.br
Tue May 25 10:43:00 GMT 1999
On May 25, 1999, Gabriel Dos_Reis <Gabriel.Dos_Reis@sophia.inria.fr> wrote:
> Alexandre Oliva <oliva@dcc.unicamp.br> writes:
> | On May 25, 1999, Gabriel Dos_Reis <Gabriel.Dos_Reis@sophia.inria.fr> wrote:
> |
> | > Checking whether the new-expression ends up by allocating sufficient
> | > memory is part of the semantics of new-expression.
> |
> | The problem is that determining how much is `sufficient' overflows ==>
> | undefined behavior, reboot the universe.
> I still fail to see how undefined behaviour follows.
> Is it drawn from the language definition?
Oops, scratch that, it's not undefined behavior, because size_t is
unsigned, so it doesn't overflow, it just wraps around, and the
results are well-defined, even if not what one would expect when
thinking of arbitrary-precision integers.
--
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
{oliva,Alexandre.Oliva}@dcc.unicamp.br aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
*** E-mail about software projects will be forwarded to mailing lists
More information about the Gcc-bugs
mailing list