Eugene,
This code is completely correct as far as I can see. The second while is interpreted as a new while loop, and the closing; is short for {} in this case. I've expanded the code into a more intuitive form here:
int main() { int a = 0;
while (a == 0) { a = 1; }
while (1) /* Do nothing */ ;
return 0; }
Regards, Bart Samwel
Eugene Morozov wrote:
Package: gcc Version: 2:2.95.4-16 Severity: normal
gcc compiles following program without emitting warning even with -Wall -ansi -pedantic. gcc-3.2 also compiles this program.
int main() {
int a = 0;
while (a == 0) {
a = 1;
} while (1);
return 0;
}
-- System Information Debian Release: 3.0 Kernel Version: Linux tanya 2.4.18 #1 Fri Apr 19 18:18:18 MSD 2002 i686 unknown unknown GNU/Linux
Versions of the packages gcc depends on: ii cpp-2.95 2.95.4-2 The GNU C preprocessor. ii cpp 2.95.4-16 The GNU C preprocessor. ii gcc-2.95 2.95.4-2 The GNU C compiler.
--
Leiden Institute of Advanced Computer Science (LIACS) E-mail: [EMAIL PROTECTED] Telephone: +31-71-5277037 Opinions stated in this e-mail are mine and not necessarily my employer's.