What is the correct way to program. In certain languages you should post the { on a new line like
if (a == b)
{
And then in others you post on the same line
if (a == b) {
I prefer the method above. I try to leave a comment above anything major such as
// This determines ......
if (a == b) {
and of course an explanation above every function. If I have a nest IF/FOR/function statment I try to comment the ending }
Code:// Main Function void main() { // The Dermines ..... if (a == b) { code..... } // End If }
What standard do you guys use?
I use similar although I put the bracket { on a new line like
if (a == b)
{
I think it looks cleaner.
i would prefer starting the new command in a new line. its always better to do so as far as i think.
i also use to put in a new line only
As everyone should know by now, the K&R style of putting the brace at the end of the line is The One True Brace Style.
However, VS.NET does (by default) force you to use the inferior BSD/Allman style of taking an entire line for a single brace.
That's why I prefer VB.NET.![]()
I've never heard of the names for either style. Where did you learn about these? The admin needs to make a sticky about the two different styles.Originally Posted by brackett
"The One True Brace Style" - lol![]()
I think I first came across the naming convention on somebody's C# blog that linked to the Wikipedia entry. Before that, I just defended the K&R style as being classic and wasting less lines - it also maps nicely to my preferred syntax - VB.NET. Then again, most of my C code is done in vi, so fitting as much as possible on a screen is pretty helpful.Originally Posted by Crane
Interesting. I've never heard of either style being named. I'm going to dig up some information on them.
I always put my {on the same line, its much easier to read.
I end it though on a line of its own.
I have never heard names for them. I use "The One True Brace" style (where it is on a seperate line).
DirkFirst Tutorials | Linux Forum
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks