Semicolon after if-statement
Clever Code
2
Posts
2
Posters
2
Views
1
Watching
-
Semicolon after if-statement : int a = 10; if(a == 2); // Bug ! There shouldn't be a semicolon here ! System.out.println("This line will now ALWAYS be executed !");
Again, as I just posted, as someone who uses the Digital Mars C++ compiler (formerly Symantec C++ and before that Zortech or the like) I never get this problem as the compiler always warns of the semi=colon. In the unlikely case where you do want a semicolon, to keep the compiler happy, you just need to insert some C comment: while (flag) /* Wait */; Paul