Lost Password?


Go Back   CodeCall Programming Forum > Software Development > General Programming

General Programming Non language specific, Assembly, Linux/Unix, Mac and anything not covered in other topics. Talk about Programming Theory here.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-04-2006, 09:06 AM
Lop's Avatar   
Lop Lop is offline
Speaks fluent binary
 
Join Date: May 2006
Posts: 1,149
Rep Power: 18
Lop will become famous soon enoughLop will become famous soon enough
Default Coding Methods

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?
__________________
Lop
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 05-05-2006, 01:25 PM
NeedHelp NeedHelp is offline
Programming God
 
Join Date: May 2006
Posts: 527
Rep Power: 13
NeedHelp is on a distinguished road
Default

I use similar although I put the bracket { on a new line like
if (a == b)
{

I think it looks cleaner.
__________________
I Need Help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-11-2006, 02:45 PM
sigs sigs is offline
Learning Programmer
 
Join Date: Apr 2006
Posts: 34
Rep Power: 10
sigs is on a distinguished road
Default

i would prefer starting the new command in a new line. its always better to do so as far as i think.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 05-13-2006, 01:59 AM
moonrise moonrise is offline
Learning Programmer
 
Join Date: May 2006
Posts: 40
Rep Power: 10
moonrise is on a distinguished road
Default

i also use to put in a new line only
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 05-22-2006, 04:34 PM
brackett brackett is offline
Programmer
 
Join Date: May 2006
Posts: 193
Rep Power: 11
brackett is on a distinguished road
Default The One True Brace Style

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 05-22-2006, 05:57 PM
Crane's Avatar   
Crane Crane is offline
Programming Expert
 
Join Date: Nov 2005
Posts: 399
Rep Power: 14
Crane is on a distinguished road
Smile

Quote:
Originally Posted by brackett
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.

"The One True Brace Style" - lol
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 05-23-2006, 09:00 AM
brackett brackett is offline
Programmer
 
Join Date: May 2006
Posts: 193
Rep Power: 11
brackett is on a distinguished road
Default

Quote:
Originally Posted by Crane
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.

"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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 05-24-2006, 05:06 PM
Lop's Avatar   
Lop Lop is offline
Speaks fluent binary
 
Join Date: May 2006
Posts: 1,149
Rep Power: 18
Lop will become famous soon enoughLop will become famous soon enough
Default

Interesting. I've never heard of either style being named. I'm going to dig up some information on them.
__________________
Lop
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 05-25-2006, 03:21 AM
Frantic's Avatar   
Frantic Frantic is offline
Learning Programmer
 
Join Date: May 2006
Posts: 92
Rep Power: 10
Frantic is on a distinguished road
Default

I always put my {on the same line, its much easier to read.

I end it though on a line of its own.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 07-13-2006, 07:24 PM
dirkfirst dirkfirst is offline
Programming Professional
 
Join Date: May 2006
Posts: 338
Rep Power: 12
dirkfirst is on a distinguished road
Default

I have never heard names for them. I use "The One True Brace" style (where it is on a seperate line).
__________________
DirkFirst
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
New Anti-Cheat Community needs coding help avguste PHP Forum 8 04-04-2008 05:42 PM
Coding a stock ticker accessing an asp DB gtg100i General Programming 2 12-10-2006 10:33 AM
Classes, Methods, and Objects Sionofdarkness Java Help 6 08-21-2006 01:55 PM
How long have you been coding php? cpvr PHP Forum 11 07-11-2006 01:41 PM
More Coding Methods RobSoftware General Programming 2 05-30-2006 05:42 PM


All times are GMT -5. The time now is 08:05 AM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 100%


Complete - Celebrate!

Ads