FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Your strangest coding style preference





jmraker
What do you think is your strangest coding style preference?

I think mine is: If a comment is on it's own line I like to put the start comment mark as the first letter.
Code:
    if($a == 0){
        if($b == 0){
//         $b is zero
        }
    }

as opposed to putting it up against the comment like
Code:
    if($a == 0){
        if($b == 0){
            // $b is zero
        }
    }


I guess it's so if I end up with a lot of commented out code using // instead of /* code */ the slashes line up
Code:
//  if($a == 0){
//      if($b == 0){
// //      $b is zero
//      }
//  }


My text editor is able to show it's a comment either way. I also do the same with temporary var_dump() statements so they're easier to find and remove when I fix whatever was wrong with a program.
Marcuzzo
Programmers are by definition lazy Very Happy so when I need to comment out a block of code I usualy leave it up to the built in function of the IDE or Texteditor.
When I need comment for documentation or intellisense I use the same indentation as the statement or function

When I need to add comment to a statement in the function I would generally do the following
Code:

if ( condition )
{
    // do something here
    this.do_something(withVariable);
}


and for methods/functions
Code:
/**
* Description bla bla bla
* @param.........and so on
**/
Peterssidan
I usually use // for text comments and /* */ to temporary comment out code. That way they never interfere.

I don't think I have any strange coding styles. If I thought something was strange I would probably do it in another way.
codegeek
I always type in the brackets (parenthesis, braces and square brackets) and the single as well as double quotes in pairs. Then, I press the right arrow key to get inside the pair and start typing.

For example, I type in printf(); first, and the edit it to printf(""); and finally printf("Hello world!");.

I don't know if it's less efficient or more efficient, I just cannot get myself to type in just a single bracket or quotation without it's pair. Smile
codersfriend
for me there is nothing strange with your code above.. or have I gotten strange already.. lol Razz
Related topics
Learn how to change ScrollBar colors!!
Webpage Design Programs
PHP OOP Tutorial
...
Disabling "This is a string with a $var"?
Scripting Language
Learn JAVA and get a Job
too short table
The Game creation topic! - Share experience - Find resources
Game Engines
Is it a bad practice?
Force table size?
old styles?
Placement of Brackets in php code
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.