void Function( int, char )
versus:
void Function (int,char)
My friend keeps saying otherwise. What is objectively the best way to write brackets?
void Function( int, char )
versus:
void Function (int,char)
My friend keeps saying otherwise. What is objectively the best way to write brackets?
There is not a best way. There is just a preferred way, and that changes from person to person. There are many different semantics that various programmers with bicker on about style. I have personally seen the following 3 ways in commercial code:
void DoSomething(int,float,string);
void DoSomething(int, float, string);
void DoSomething( int, float , string );
Although I have a preference for one of these, I can't tell someone that my way is best. Therefore the best advice is to write what works best for you, or the chosen style for a given collaborated project.
float
? I can't edit it since it's a single-character edit.
– Almo
Mar 03 '14 at 14:05
There is no best way, but there are some cases where one way is better than another.
If you're working as part of a team, that team will have it's own coding style, and you should conform to that.
If you've inherited a bunch of legacy code you may prefer to conform to the coding style already used by that legacy code.
If you're coding something on your own you can sometimes just use whichever style you find most readable.
If you're writing something where a pre-defined style already exists and is expected to be used (e.g a GNU utility) you'd better use that pre-defined style.
However, in a world where source code formatters exist and are common (and free) discussions or arguments over coding style seem silly.