bug-gplusplus
[Top][All Lists]
Advanced

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

Re: while (0) {;} while (1) compiles?!


From: Bob DeJoie
Subject: Re: while (0) {;} while (1) compiles?!
Date: Wed, 13 Dec 2000 01:39:15 GMT

On Mon, 11 Dec 2000 14:13:39 -0800, address@hidden (Dan
Kegel) wrote:

The while(0) never executes, the while(1) is an infinite loop.

Same program white space changed for clarity.

main()
{
       while (0) {
                int x;
        } 

        while (1)  {
        ;
        }
}     
>In gcc (egcs-2.91.66 or 2.95.2), the following compiles without error:
>
>main()
>{
>        while (0) {
>                int x;
>        } while (1);
>}     
>
>Question: what is the proper behavior in this case? :-)
>
>Sorry to admit I actually ran into this.
>
>- Dan

================================================
Bob DeJoie      
Kwajalein Missile Range
Republic of the Marshall Islands
email: address@hidden
phone: 805-355-5855   fax: 805-355-3833
Time Zone: GMT +12 hours                     
================================================



reply via email to

[Prev in Thread] Current Thread [Next in Thread]