F
forums_mp
Operator new as defined in Section 18.4 of the 2003 edition is as
follows:
void *operator new (size_t) throw
(std::bad_alloc); ///1
void *operator new[] (size_t) throw
(std::bad_alloc); ///2
void *operator new (size_t, const std::nothrow_t&)
throw(); ///3
void *operator new[] (size_t, const std::nothrow_t&)
throw(); ///4
Yet 5.3.4(13) states:
[unless an allocation function is declared with an empty-exception
specification (15.4), throw(), it indicates failure to allocate
storage
by throwing a bad_alloc exception (clause 15, 18.4.2.1); it returns a
non-null pointer otherwise. If the allocation function is declared
with
an empty exception-specification, throw(), it returns null to
indicate
failure to allocate storage and a non-null pointer otherwise. ]
Two questions:
a) Does the reference to 'allocation function is declared with an
empty-exception specification (15.4), throw()' imply items '///3' and
'///4' as shown above?
b) I'm under the impression that section 18.4 is binding, that said,
if I provide overriding definitions then those those definitions ought
to comply with 18.4. True or False?
Thanks in advance
follows:
void *operator new (size_t) throw
(std::bad_alloc); ///1
void *operator new[] (size_t) throw
(std::bad_alloc); ///2
void *operator new (size_t, const std::nothrow_t&)
throw(); ///3
void *operator new[] (size_t, const std::nothrow_t&)
throw(); ///4
Yet 5.3.4(13) states:
[unless an allocation function is declared with an empty-exception
specification (15.4), throw(), it indicates failure to allocate
storage
by throwing a bad_alloc exception (clause 15, 18.4.2.1); it returns a
non-null pointer otherwise. If the allocation function is declared
with
an empty exception-specification, throw(), it returns null to
indicate
failure to allocate storage and a non-null pointer otherwise. ]
Two questions:
a) Does the reference to 'allocation function is declared with an
empty-exception specification (15.4), throw()' imply items '///3' and
'///4' as shown above?
b) I'm under the impression that section 18.4 is binding, that said,
if I provide overriding definitions then those those definitions ought
to comply with 18.4. True or False?
Thanks in advance