LabWindows/CVI Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
CVI-User

How about a warning for things like "if (...) ;"?

I'd really appreciate a warning for "empty bodies" or whatever it is called, i.e. things like

 

for(...);
while(...);
if(...);

 If written like

if(...) { };

 it is OK.

 

-----------------------
/* Nothing past this point should fail if the code is working as intended */
2 Comments
LuisG
NI Employee (retired)
Status changed to: Under Consideration
 
m-a
Member
Member

Only useful for if (...) else constructs, because there's too much code that legitimately uses null statements (empty blocks) in while or for loops.

 

Also note that you should not place a semicolon after the constructs shown, if (condition) {}; else {} is actually invalid syntax (that's different from struct/enums - but there the braces don't embrace a block).