This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cannot pass objects of non-POD type

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 <> 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
> > cannot diagnostic an undefined runtime behavior.  So the code is valid
> > semantically but undefined at runtime.
> 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 at
> and this definition specifies that everything will look exactly the same
> as if it were a POD with the same members declared in the same order.

I don't think that's true.  I believe the non-POD must be passed in
memory, but GCC would be permitted to pass the POD in a register if it
preferred.  The layout is defined by the C++ ABI, but not the argument
passing conventions.

Daniel Jacobowitz

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]