# [PATCH] curly braces around some asserts

This topic is 2095 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

The attached/proposed patch addresses a handful of if's/else's which are immediately followed by an asASSERT(), without any curly braces. In case the underlying assert is compiled out entirely, this can lead to unintended consequences.

For example:

Index: as_symboltable.h
===================================================================
--- as_symboltable.h	(revision 1811)
+++ as_symboltable.h	(working copy)
@@ -380,7 +380,9 @@
m_map.Erase(cursor);
}
else
+    {
asASSERT(false);
+    }


##### Share on other sites

This shouldn't be a problem. if asASSERT() is defined to blank, the resulting code after preprocessing is:


@@ -380,7 +380,9 @@
m_map.Erase(cursor);
}
else
;


The ; ends the else, so there is no unintended consequence.

##### Share on other sites

Fair enough. I prefer being more explicit, but thanks for the clarification.

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 16
• 11
• 23
• 42
• 75