Input from a newbie
Stefan
stefan at schuerger.com
Mon Apr 9 23:27:27 PDT 2012
On Monday, 9 April 2012 at 20:18:29 UTC, Ali Çehreli wrote:
>> The GCC C compiler proves you wrong :) They have warnings. I
>> guess it's
>> a hack (because printf really doesn't belong into the
>> compiler) but that
>> doesn't matter. What matters is user-friendliness.
>
> Indeed. dmd should warn about any incompatible data passed as
> variadic parameters. It's simple to decide: only fundamental
> types that correspond to C counterparts should be allowed.
> Hmmm... Even that's not that simple: int is 32 bits in D but
> unspecified in C.
Maybe printf should not be visible at all - or under a different
name ("cprintf" or something similar). It's just too tempting...
C variadic arguments are one of the most unsafe features of the C
language. A total mess.
Stefan
More information about the Digitalmars-d-learn
mailing list