Bug 11532 – Variadics using the C ABI should not accept D-specific types
Status
RESOLVED
Resolution
WORKSFORME
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-11-16T23:21:11Z
Last change time
2018-10-19T05:58:20Z
Keywords
pull
Assigned to
No Owner
Creator
Andrei Alexandrescu
Comments
Comment #0 by andrei — 2013-11-16T23:21:11Z
The ABI for C variadics (e.g. printf and friends) does not understand D data types, in particular slices and fixed-size arrays.
We should reject statically any passing of D-specific data through C-style variadics.
This has been a very nagging issue during a port of a large C codebase.
Comment #1 by ibuclaw — 2013-11-17T00:18:27Z
They do map to C ABI, just not in the way which you may likely expect.
I'd +1 fixed size arrays, as it is not obvious that eg: int[4] is passed as struct { int a,b,c,d; }
Though I'd really like to make some sort of exception to the va_list type (in particular, for x86_64 and PPC). That has been one nagging problem I haven't yet got round to...