Null Statements
In C++, it's possible to have a null statement, a statement consisting entirely of a semicolon, as shown here:
Example 19-23. C++ Example of a Traditional Null Statement
while ( recordArray.Read( index++ ) != recordArray.EmptyRecord() ) ;
The while in C++ requires that a statement follow, but it can be a null statement. The semicolon on a line by itself is a null statement. Here are guidelines for handling null statements in C++:
Call attention to null statements. Null statements are uncommon, so make them obvious. One way is to give the semicolon of a null statement a line of its own. Indent it, just as you would any other statement. This is the approach shown in the previous example. Alternatively, you can use a set of empty braces ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access