Barr Group FacebookBarr Group TwitterBarr Group LinkedInBarr Group Vimeo

Rules

The following C coding rules relate to the declaration of variables:

Rule 8.1.a.) The comma (,) operator shall not be used within variable declarations.

Example

// DON'T do this...
char * x, y;   // Is y supposed to be a pointer?

Reasoning

The cost of placing each declaration on a line of its own is low. By contrast, the risk that either the compiler or a maintainer will misunderstand your intentions is high.

Exceptions

None.

Enforcement

These rules shall be enforced during code reviews.

What’s happening and how it’s done. Get in the know.

Sign up for our newsletter today!

Receive free how-to articles, industry news, and the latest info on Barr Group webinars and training courses via email. 

To prevent automated spam submissions leave this field empty.