April 18, 2008 [Issue 2005] New: dynamic va_arg looping/ align info in TypeInfo | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=2005 Summary: dynamic va_arg looping/ align info in TypeInfo Product: D Version: unspecified Platform: All OS/Version: All Status: NEW Keywords: spec Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: fawzi@gmx.ch Looping over va_arg that span a set of types that is unknown is error prone. In dmd this seem to work because va_list is a void* and one can simply add the size of the actual type to go to the next. Actually such a method does not keep into account alignment issues, and no alignment information is present in TypeInfo. A clean way to solve this would be to add a function like void *dyn_va_arg(TypeInfo, inout va_list) that returns a pointer to the actual argument and updates va_list. If one wants to allow even more flexibility in the implementation of va_list then the function should be void *dyn_va_arg_tmp(TypeInfo, inout va_list, out bool); and the pointer returned by this functions would be invalided at the next call of va_arg if bool says so. Such functions could be readily implemented for dmd if typeinfo would give access to the alignment information of its type (.talign?). Also for gdc it should be possible to implement this function (at least the second one), and it would solve or at least alleviate the much more serious issues that gdc has in that department, something that I proposed in http://d.puremagic.com/issues/show_bug.cgi?id=2004 Another possibility would be to change _args to a void*[] in D2, this would also solve all the issues, but would add some overhead that the actual implementation does not have. -- |
April 23, 2008 [Issue 2005] dynamic va_arg looping/ align info in TypeInfo | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2005 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement -- |
Copyright © 1999-2021 by the D Language Foundation