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 04:50:58PM -0500, John Gateley wrote:
> On Wed, 24 Oct 2007 12:37:50 -0700
> "Andrew Pinski" <> 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 very simple, purposely so.
> While for complex objects, passing them could be a disaster,
> in this case it is a simple clean construction that is useful.
> I'm working on porting approximately a million lines
> of code (which also must remain working on the original
> platform), and the pun (using a struct/class containing a
> single data member which is a pointer to char, and not
> containing a vtab) is pervasive throughout. It would be
> really nice if I didn't have to do thousands of changes
> like:
>  Format("%s", Object)
> becoming
>  Format("%s", (char *)Object));

An alternative might be to define an overload

void Format(const char* format, const Object& obj) {
	Format(format, Object.char_member);

and likewise for uses that take more arguments.

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