www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Variadic arguments and object references.

reply Andy Friesen <andy ikagames.com> writes:
When passing object references into a function that accepts variadic 
arguments, it has to be explicitly cast as whatever the function is 
going to convert it to during extraction.  If not, then, due to vtable 
layouts and so forth, the pointer will likely be off a bit, and the 
program will segfault when it tries to use the object.

The only thing I can suggest is that object references be implicitly 
cast to Object when passed to a variadic function.

  -- andy
Jun 24 2004
parent "Walter" <newshound digitalmars.com> writes:
Can you give an example?

"Andy Friesen" <andy ikagames.com> wrote in message
news:cbg88i$f4i$1 digitaldaemon.com...
 When passing object references into a function that accepts variadic
 arguments, it has to be explicitly cast as whatever the function is
 going to convert it to during extraction.  If not, then, due to vtable
 layouts and so forth, the pointer will likely be off a bit, and the
 program will segfault when it tries to use the object.

 The only thing I can suggest is that object references be implicitly
 cast to Object when passed to a variadic function.

   -- andy

Jun 27 2004