Quantcast

Maximum PC

It is currently Thu Apr 17, 2014 2:14 pm

All times are UTC - 8 hours




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

Where should curly braces {} be placed?
function() { 0%  0%  [ 0 ]
function() /*line break here*/{ 100%  100%  [ 1 ]
Total votes : 1
Author Message
 Post subject: Curly brace location
PostPosted: Thu Sep 25, 2008 1:20 pm 
Team Member Top 1000
Team Member Top 1000
User avatar

Joined: Wed Jul 02, 2008 1:41 pm
Posts: 252
hey I'm sure this question has been asked before here and it will continue to be a debate among engineers but I just want some of your opinions.

by the way, I had to fit the options on one line.

first choice:
Code:
function() {
some code
}


2nd choice:
Code:
function()
{
some code
}


Top
  Profile  
 
 Post subject:
PostPosted: Thu Sep 25, 2008 1:29 pm 
8086
8086

Joined: Thu Sep 25, 2008 11:15 am
Posts: 2
This is of course purely a style issue not a functional one. That being said I prefer to have a line break (option 2). I find it gives me a better sight-line (reference) to where the block of code starts and where it ends.


Top
  Profile  
 
 Post subject:
PostPosted: Thu Sep 25, 2008 4:29 pm 
Team Member Top 1000
Team Member Top 1000
User avatar

Joined: Wed Jul 02, 2008 1:41 pm
Posts: 252
yeah that's what I think, it's easier to keep track of your braces. also, it increases the amount of lines of code by 1 per function or loop or whatever so it seems like you wrote more code.


Top
  Profile  
 
 Post subject:
PostPosted: Thu Sep 25, 2008 5:41 pm 
Java Junkie
Java Junkie
User avatar

Joined: Mon Jun 14, 2004 10:23 am
Posts: 24218
Location: Granite Heaven
Congrats. I think you've started the first thread that sucks so bad that I'm going to lock it on general principle.


Top
  Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group