Input from a newbie

Ali Çehreli acehreli at yahoo.com
Mon Apr 9 13:18:29 PDT 2012


On 04/09/2012 08:50 AM, Jonas H. wrote:
> On 04/09/2012 05:39 PM, Andrej Mitrovic wrote:
>> I don't think the compiler can warn about this. Isn't printf one of
>> those unsafe C variadic functions? Someone correct me if I'm wrong.
>
> 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.

Ali


More information about the Digitalmars-d-learn mailing list