Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > A constructor calling another constructor (default constructor)?

Thread Tools

A constructor calling another constructor (default constructor)?
Posts: n/a
On Nov 27, 9:25 pm, "Alf P. Steinbach" <(E-Mail Removed)> wrote:
> But then there is a more subtle UB argument which would apply more
> generally (even for the case of an empty class such as the example code)
> namely that by completing execution of two constructors of class T for
> the same memory region, two objects have been created in the same memory
> region. And the argument has been put forward that this is illegal for
> non-POD classes, but I haven't seen this backed up by references to the
> standard.

I also started thinking about the non-POD member case after I wrote
that. At the very least running the placement new hack would run the
member constructors twice, which might be harmless in some cases, but
certainly has the potential for odd results in others.
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Calling Class Constructor from Another Constructor Alf P. Steinbach C++ 4 11-30-2007 09:56 PM
Calling constructor inside another constructor Neroku Java 8 11-18-2006 10:19 AM
Calling another constructor from a constructor Asfand Yar Qazi C++ 6 05-17-2004 03:16 PM
calling a constructor within a constructor Brett Irving C++ 3 06-29-2003 10:43 AM
why it's not possible calling constructor from constructor? Giulio C++ 9 06-25-2003 03:56 PM