On 12/09/2016 10:18 AM, Martin Sebor wrote:
On 12/09/2016 08:09 AM, Jakub Jelinek wrote:
On Fri, Dec 09, 2016 at 08:04:11AM -0700, Martin Sebor wrote:
then (IMO) so is this:
struct Foo {
int a;
char ary[];
Foo () : ary ("bob") {}
};
So what does this mean? Assume that the Foo object lives on the heap
and has been allocated with extra space after it? Or shall
global/automatic
objects of type Foo be allocated with the extra space (like
struct Foo x = { 5, "bob" }; in C would do if the Foo () ... line is
removed?
Something different?
It means the same thing as the first case, down to sizeof (Foo).
All of Foo's ctors would have to agree on the size of the initializer
1) if the ctors are not defined in the structure definition, how will
this interact with separate compilation? (all the ctor definitions might
be in TUs not visible from the TU calling them)
2) why distinguish this case from the NSDMI case? NSDMI is essentially
syntactic sugar to avoid repeating the ary member init in each ctor.
3) where in C++ is the layout of an object determined by anything other
than its data member definitions?
nathan
--
Nathan Sidwell