coding style: curly brackets - why like this?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

lcidw
Forum Commoner
Posts: 58
Joined: Mon Apr 28, 2003 8:55 am
Location: Netherlands

Post by lcidw »

twigletmac wrote:if is a control structure - not a function
Isn't a control structure actually a function too?
User avatar
releasedj
Forum Contributor
Posts: 105
Joined: Tue Jun 17, 2003 6:35 am

Post by releasedj »

No. A control structure is considered a statement that groups statements, and is part of the core language.

http://www.php.net/control-structures
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post by phice »

phpBB has an outstanding guideline of how they want all of their programmers to program by. I would make note of that.
Image Image
redJag
Forum Newbie
Posts: 18
Joined: Fri Jan 31, 2003 12:17 am

Post by redJag »

I don't know what style it is, but I code like so:

Code: Select all

void function () {

     if (condition){
          //code
      }
      else{
          //other code
      }
//no spaces for debug lines
 return; //one space for return lines
}
Is this a style?
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post by nielsene »

Anything is a style.

Your's looks like a modified K&R. But it seems to mix the "braces on a line by themselves" and "pack braces tightly" common patterns, so its likely to look "bad" to both camps...
Post Reply