For Programmers: Free Programming Magazines  


Home > Archive > C > August 2004 > Re: A for loop iterating over the complete range of a variable









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: A for loop iterating over the complete range of a variable
pete

2004-08-30, 3:55 am

Arthur J. O'Dwyer wrote:
>
> On Mon, 30 Aug 2004, pete wrote:
> [...]
>
> I guess you're right. What's the fix? Would
>
> } while (i=(unsigned short)i+(unsigned short)1);
>
> fix the UB?


No.
(sizeof((short)0 + (short)0)) equals (sizeof(int)).

--
pete
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com