MavEtJu's Distorted View of the World - 2010-12

Coding Styles

Back to index

Coding Styles

Posted on 2010-12-01 23:00:00
Tags: Coding, Rant, FreeBSD

Recently I stumbled over this piece of code:

if(pinfo->cinfo) {
	if (pinfo->cinfo->col_first[COL_INFO]>=0){
		for (i = pinfo->cinfo->col_first[COL_INFO]; i <= pinfo->cinfo->col_last[COL_INFO]; i++) {
and it nearly made me cry. How many different coding styles can you find in here?
  • No space between "if" and "(" on the first line.
  • Space between "if" and "(" on the second line.
  • Space between ")" and "{" on the first line.
  • No space between ")" and "{" on the second line.
  • Pointer check without a "!= NULL" on the first line.
  • No space before and after ">=" on the second line.
  • Spaces before and after "<=" on the third line.
This inconsistent coding style drives me craaaaaazy! I am so glad that the FreeBSD Project has a consistent coding style for their own source code.


No comments | Share on Facebook | Share on Twitter