Am 22.07.2014 11:01, schrieb Daniel Murphy:
Old D code (from the 32-bit only days) used to do this successfully: printf("Hello %.*s\n", "segfault"); So it relied on both the length and pointer being passed. Unfortunately this was done quite a lot, so simply changing the rules so string literals get passed to C varargs as pointers would silently (and horribly) break this code.
ok, I didn't know about that hack.. which shouldn't have been used in the first place :-P So at least for strings it kinda makes sense.. and if strings are considered char arrays (isn't there a proper string type in D2?) for consistency it should be the same for other arrays. Maybe at least the "Interfacing to C" and/or "C-style Variadic Functions" documentation could supply a bit more information about how to pass arrays and especially static arrays as vararg.
Anyway, thanks for the clarification! Cheers, Daniel