This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Here is the code given below. My question is that will it compile with assertions enabled.In my view it should not since statement //1 will be unreachable if asssertions are enabled. I tried to compile with assertions enabled and it compiled fine. But i am not able to undestand why.
[ August 03, 2005: Message edited by: Barry Gaunt ]
So you believe this should not compile with assertions enabled. Not an unreasonable assumption but that's never the case. Compile time expression values can only produce unreachable code in while, for and do statements. That way you can say if(SKIP_FLAG) ... and not have it compile in one state and not in the other. Not particularly orthogonal but useful nevertheless.