We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f9dbe28 + 5c7bb01 commit 73d9f96Copy full SHA for 73d9f96
Documentation/CodingGuidelines
@@ -232,6 +232,18 @@ For C programs:
232
while( condition )
233
func (bar+1);
234
235
+ - Do not explicitly compare an integral value with constant 0 or '\0',
236
+ or a pointer value with constant NULL. For instance, to validate that
237
+ counted array <ptr, cnt> is initialized but has no elements, write:
238
+
239
+ if (!ptr || cnt)
240
+ BUG("empty array expected");
241
242
+ and not:
243
244
+ if (ptr == NULL || cnt != 0);
245
246
247
- We avoid using braces unnecessarily. I.e.
248
249
if (bla) {
0 commit comments