in reply to Re^5: if/else syntax
in thread if/else syntax
is DEFINED asif(a) if(b) c(); else d();
But, this does not mean there is no ambiguity. It's just plain wrong to assume things without the braces because software changes constantly. So, one day you haveif(a) { if(b) c(); else d(); }
and then you see some reason for the else d(); to go away, and you stay withif( a ) if( b ) c(); else d(); else e();
That does not do what you intended and you can be looking for this bug in another place kilometers/miles away (in the code) because you left out some initialization done by e(); etc etc.if( a ) if( b ) c(); else e();
IOW: You could do that -- because it's really well-defined behaviour for the C language --, but it does not mean you should.
|
|---|