Re: cannot pass objects of non-POD type

2007-10-25 Thread Daniel Jacobowitz
On Thu, Oct 25, 2007 at 08:44:26AM -0700, Joe Buck wrote: > One of the purposes of the C++ ABI is to allow different compilers to > interoperate. The freedom you describe would prevent gcc-compiled > code from behaving correctly with icc-compiled code, for example. > So yes, argument passing conve

Re: cannot pass objects of non-POD type

2007-10-25 Thread Joe Buck
On Thu, Oct 25, 2007 at 11:25:52AM -0400, Daniel Jacobowitz wrote: > On Wed, Oct 24, 2007 at 03:06:42PM -0700, Joe Buck wrote: > > But the way that the object is passed in this case, and the stack layout, > > are completely defined on any platform that obeys the cross-platform API > > you will find

Re: cannot pass objects of non-POD type

2007-10-25 Thread Daniel Jacobowitz
On Wed, Oct 24, 2007 at 03:06:42PM -0700, Joe Buck wrote: > On Wed, Oct 24, 2007 at 01:37:25PM -0700, Andrew Pinski wrote: > > On 10/24/07, Jack Lloyd <[EMAIL PROTECTED]> wrote: > > > Is there a reason it's not just an error, then? (As a user) I don't > > > see the point of something being a warnin

Re: cannot pass objects of non-POD type

2007-10-24 Thread Gabriel Dos Reis
Joe Buck <[EMAIL PROTECTED]> writes: | On Wed, Oct 24, 2007 at 12:15:03PM -0700, Andrew Pinski wrote: | > On 10/24/07, John Gateley <[EMAIL PROTECTED]> wrote: | > > I don't think it is undefined code. The class has no virtual functions, | > > and the variable argument function doesn't need to know

Re: cannot pass objects of non-POD type

2007-10-24 Thread Joe Buck
On Wed, Oct 24, 2007 at 04:50:58PM -0500, John Gateley wrote: > On Wed, 24 Oct 2007 12:37:50 -0700 > "Andrew Pinski" <[EMAIL PROTECTED]> wrote: > > > What exactly does that mean? Do we pass it as a String or as a "b"? > > This is the reason why non-POD through variable arguments is > > undefined.

Re: cannot pass objects of non-POD type

2007-10-24 Thread Joe Buck
On Wed, Oct 24, 2007 at 01:37:25PM -0700, Andrew Pinski wrote: > On 10/24/07, Jack Lloyd <[EMAIL PROTECTED]> wrote: > > Is there a reason it's not just an error, then? (As a user) I don't > > see the point of something being a warning when the compiled code is > > intentionally set up to crash. >

Re: cannot pass objects of non-POD type

2007-10-24 Thread John Gateley
On Wed, 24 Oct 2007 12:37:50 -0700 "Andrew Pinski" <[EMAIL PROTECTED]> wrote: > What exactly does that mean? Do we pass it as a String or as a "b"? > This is the reason why non-POD through variable arguments is > undefined. True, but this relies on "b" being a virtual class. The case I had was v

Re: cannot pass objects of non-POD type

2007-10-24 Thread Andrew Pinski
On 10/24/07, Jack Lloyd <[EMAIL PROTECTED]> wrote: > Is there a reason it's not just an error, then? (As a user) I don't > see the point of something being a warning when the compiled code is > intentionally set up to crash. Because the C++ standard (and the C standard) has mentioned that you cann

Re: cannot pass objects of non-POD type

2007-10-24 Thread Jack Lloyd
On Wed, Oct 24, 2007 at 12:15:03PM -0700, Andrew Pinski wrote: > > a "real" illegal instruction, caused by g++ doing something different > > that I expected with the String object as an argument? Or is the illegal > > instruction just a "place marker" that is generated because I passed > > a non-P

Re: cannot pass objects of non-POD type

2007-10-24 Thread Andrew Pinski
On 10/24/07, Joe Buck <[EMAIL PROTECTED]> wrote: > So GCC could support this case and treat the warning as a pedwarn. Well pedwarn is wrong as the code is just undefined at runtime (not at compile time), pedwarn is for errors when the error is very pedantic. Also he wants to do printf("%s", struc

Re: cannot pass objects of non-POD type

2007-10-24 Thread Richard Guenther
On 10/24/07, Joe Buck <[EMAIL PROTECTED]> wrote: > On Wed, Oct 24, 2007 at 12:15:03PM -0700, Andrew Pinski wrote: > > On 10/24/07, John Gateley <[EMAIL PROTECTED]> wrote: > > > I don't think it is undefined code. The class has no virtual functions, > > > and the variable argument function doesn't n

Re: cannot pass objects of non-POD type

2007-10-24 Thread Joe Buck
On Wed, Oct 24, 2007 at 12:15:03PM -0700, Andrew Pinski wrote: > On 10/24/07, John Gateley <[EMAIL PROTECTED]> wrote: > > I don't think it is undefined code. The class has no virtual functions, > > and the variable argument function doesn't need to know the full size > > of the struct, since it is

Re: cannot pass objects of non-POD type

2007-10-24 Thread Andrew Pinski
On 10/24/07, John Gateley <[EMAIL PROTECTED]> wrote: > I don't think it is undefined code. The class has no virtual functions, > and the variable argument function doesn't need to know the full size > of the struct, since it is not using it as a String object, it is using > it as a char * pointer (

Re: cannot pass objects of non-POD type

2007-10-24 Thread John Gateley
On Wed, 24 Oct 2007 12:03:38 -0700 "Andrew Pinski" <[EMAIL PROTECTED]> wrote: > On 10/24/07, John Gateley <[EMAIL PROTECTED]> wrote: > > The situation is this: I have a lot of code that uses a string class > > which takes advantage of the pun: the string class has only the > > one data member, whi

Re: cannot pass objects of non-POD type

2007-10-24 Thread Andrew Pinski
On 10/24/07, John Gateley <[EMAIL PROTECTED]> wrote: > The situation is this: I have a lot of code that uses a string class > which takes advantage of the pun: the string class has only the > one data member, which means you can do things like printf("%s", obj) > and have the right thing happen (us

cannot pass objects of non-POD type

2007-10-24 Thread John Gateley
Hi. I'm having trouble with the dreaded: cannot pass objects of non-POD type 'sometype' through '...' message. Here's a brief example: class String { public: void SetData(char *NewData) { m_Data = NewData; } char *m_Data; }; int Bar(char *s, va_list ArgList