Re: verify problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Michael A. Peters wrote:
Ashley Sheridan wrote:


I'm more a fan of lining up opening and closing brackets so they are at
the same indent level. It prevents one of the most popular errors caused
by omitting a bracket, brace or other in the wrong place. A few extra
line breaks in the code are not going to make a noticeable impact on the
file size of the script!

It's fairly easy to check for missing } with my method as well

statementA {
   statementa1
   statementa2
   statementa3
statementB {
   statementb1
   statementb2
   }


You can see the missing bracket for statementA by seeing that statementB doesn't have one above it.

I also generally create my } as soon as I create the { so I can comment the } identifying what it closes.

I don't always comment it, but when I don't there are times I did when trying to track down a logic issue in nested loops.

But - how to indent - if it's your project, whatever floats your boat, if it's a group project, you conform to the group specification for indenting (almost nothing is worse than several different indentation methods in a source file edited by multiple people - especially mixing real tabs and spaces, unix line breaks and dos line breaks.)


actually much of this discussion is null and voided by using a decent IDE, certainly eclipse, netbeans, zend ide all handle much of the formatting and indenting - the one gripe I have is that PDT2 is lacking the "format source" option which is a vast time-saver when using eclipse for most other languages.

also, they all show PHP syntax errors which obviously provides cover for the main problem, missing brackets n braces.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux