Click here to Skip to main content
15,881,813 members
Articles / Programming Languages / C++

"if" with no code block parenthesis

Rate me:
Please Sign up or sign in to vote.
5.00/5 (5 votes)
12 Feb 2011CPOL 21.7K   1  
Avoid using "if" with no code block parenthesis

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
17 Feb 2011paladin_t
Whatever, I agree with you, it would be worse in C / C++ code using macros.Suppose you got a multiline macro like this:#define some_macro \ do_something_1(); \ do_something_2();And using this macro without parenthesis:if(...) some_macro;orfor(...) ...
Please Sign up or sign in to vote.
10 Feb 2011Andrew Rissing
Always review all changes before submitting them. Especially, if using a global find and replace.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) nVidia Corporation
India India
Prafulla is a passionate software developer. He has mostly worked on C++ and .NET projects. He has a Masters Degree in Software Systems from BITS, Pilani India. Currently he is working for nVidia corporation as a Senior System Engineer.

He is an embedded technology enthusiast. He likes to spend his time on electronics projects.

Comments and Discussions