lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


In message <5D2A198567EED311BD0F009027A25C87D3E0DA@SRVMAIL-ANN>, Benoit Germain
 writes:
> 
> I don't know the compiler behaviour regarding integer promotion when passing
> scalar values to variable number argument functions, since I don't know the
> promotion policy (do they all get promoted to long or int ?). I have tried a

char, short, int all get promoted to int.  long stays as long.  long
long (C1999) stays as long long.

Basically USE_INT and USE_LONG should be fine because those types
don't change under the default argument promotions.

> temporary hack by adding a USE_LONGLONG number definition in luser_number.h,
> disregarding the fact that it is not supported by ansi C89, and the compiler
> does not issue a warning for this particular problem. Maybe somebody who has
> a 16-bits target could try and see what happens when compiling with USE_INT
> and USE_LONG ?
> 
> But then, maybe this automatic float->double promotion is not a standard
> language feature, and this change is not necessary for all compilers ? 

float to double promotion for vararg functions is a standard language
feature (default argument promotions).  It sounds like your change
is necessary.