infinite for-loop and related question

Jonathan Wakely jwakely.gcc@gmail.com
Thu Feb 17 14:08:00 GMT 2011


On 17 February 2011 13:09, Axel Freyn wrote:
>>
>> I'm guessing you didn't bother to actually compile that and test it?
> Well, I did. But using gcc instead of g++. I get values <128 as soon as
> I add the integer conversion (in C code).

Jason's original code used char i(1) which is not valid C  ;-)

In any case, I get the same behaviour in C as C++, the cast to int
makes no difference.

Did you use optimization?

>> See 5.2.2 [expr.call] paragraph 7 in the C++ standard.  Arguments to
>> varargs functions are subject to integral promotions.
> In C++ it does not make any difference.

C has the same rules for default argument promotions, see 6.5.2.2 paragraph 6



More information about the Gcc-help mailing list