Compound statements?
What is the function of a compound statement if it is not associated with a conditional? (if(), for(), while() etc.)
to... not compile.
With the exception of "for"; an omitted conditional will be replaced with "true".
With the exception of "for"; an omitted conditional will be replaced with "true".
If you mean something like:
Then the nested compound statement introduces a new scope. You can use it to make sure a temporary value you need is destroyed as soon as it isn't being used. Ex:
{ //stuff // something that isn't an if, while, etc. { // other stuff }}
Then the nested compound statement introduces a new scope. You can use it to make sure a temporary value you need is destroyed as soon as it isn't being used. Ex:
Mutex m("mutex name"); { Lock l(m); // stuff that needs to be done while the mutex is locked } // mutex is unlocked as as the scope is exited
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement