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.
1 parent af6b65d commit 5c7bb01Copy full SHA for 5c7bb01
Documentation/CodingGuidelines
@@ -238,6 +238,18 @@ For C programs:
238
while( condition )
239
func (bar+1);
240
241
+ - Do not explicitly compare an integral value with constant 0 or '\0',
242
+ or a pointer value with constant NULL. For instance, to validate that
243
+ counted array <ptr, cnt> is initialized but has no elements, write:
244
+
245
+ if (!ptr || cnt)
246
+ BUG("empty array expected");
247
248
+ and not:
249
250
+ if (ptr == NULL || cnt != 0);
251
252
253
- We avoid using braces unnecessarily. I.e.
254
255
if (bla) {
0 commit comments