gcc - What is an innermost "if" statement and an enclosing "if"? -
first, please allow me post screenshot of man page of gcc.
the sentence above second bundle of demo code confuses me, written "so there no way 'else' belong enclosing 'if'." far try idea of author, innermost if statement if(b)
, foo();
. intended refer if(b) when said "enclosing 'if'". if guess right, demo code should this:
{ if(a) { if(b) foo(); } else bar(); }
am right? question turns out "enclosing 'if' " is.
the "enclosing if" if
in body ("inner") if "enclosed".
the sentence confuses correct. paragraph states, should put parenthesis shown in second example achieve same result in first example (but without warning gcc
).
if want have code suggested indentation of example 1, example correct.
now sentence means is: in example 1 else
clause belongs inner if
, accident (when behaviour in example desired). when write code in example 2, "there no way" have intended this.
Comments
Post a Comment