www.digitalmars.com         C & C++   DMDScript  

D.gnu - [Issue 2004] New: no clean way to dynamically loop over va_args

reply d-bugmail puremagic.com writes:

           Summary: no clean way to dynamically loop over va_args
           Product: DGCC aka GDC
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: glue layer
        AssignedTo: dvdfrdmn users.sf.net
        ReportedBy: fawzi gmx.ch
OtherBugsDependingO 670,1968

due to the structure of va_list there is no easy way to loop over unknown

Skipping them based on their size is not easy even using tricks (a template
generating a fake structure of the requested size), because also the alignment
must be known and it is difficult to gather from typeinfo.

One possibility would be to re-implement 

The cleanest thing would be either to either implement a function
void *dyn_va_arg(TypeInfo,va_list) that returns a pointer to the type, and
skips it.
Barring alignment issues of the arguments passed in the registers, this should
be easy for the compiler to implement.

If alignment issues are a problem then I think that a
void*dyn_va_arg_tmp(TypeInfo,va_list,out bool) that gives a temporary pointer
and says if the pointer is temporary could be considered, but only as last
resort, if at all possible a clean re-implementation of va_arg for D should be

Such a function would make boxer, tangos Layout and similar things possible in
a clean way.

Apr 18 2008
parent d-bugmail puremagic.com writes:

Iain Buclaw <ibuclaw ubuntu.com> changed:

           What    |Removed                     |Added
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID

--- Comment #1 from Iain Buclaw <ibuclaw ubuntu.com> 2011-01-31 09:39:09 PST ---
As per, bug1066, closing.

Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 31 2011