[wp-hackers] Coding style (if : endif vs if {})

Mark Shields marks at ibbsonline.com
Fri Jul 9 18:25:27 UTC 2004


This leads to a very interesting point.  In recent index.php files, it 
began using a different style of coding for "the loop".  I admit I'm not 
familiar with it, but this new style seems to go with the coding 
philosophy of WordPress devs.  If you'll look in the developer's guide 
under documentation on the main website, it is stated
   'Furthermore if you have a really long block put a short comment at 
the end so people can tell at glance what that ending brace ends. Don't 
clutter the code though, only do this if the logic block is longer than 
about 35 rows.'

This seems a step in the right direction (according to WordPress devs).

Rich Bowen wrote:

>First, the disclaimer: I DO NOT want to create an issue where there is
>none. I don't want to start a holy war. I have personal preferences, but
>intend to adhere to whatever the local convention is. I'm much more
>intested in making my patches easy to apply than in espousing a
>particular style.
>
>ok.
>
>So I noticed this diff:
>http://cvs.sourceforge.net/viewcvs.py/cafelog/wordpress/wp-admin/edit-comments.php?r1=1.28&r2=1.29
>And I notice that in the diff, in addition to the functional change,
>based on my submitted patch, there was also the style change of changing
>a if { } block to an if : endif block. This appears to contradict the
>instructions in the style guide.
>
>What I need/want to know is a) whether it really matters, with respect
>to future patches and b) which is in fact the preferred style.
>
>Thanks for input on this matter, and 10k apologies ahead of time if
>this, in any way, starts a holy war. That is not my intention, and
>surely just wastes everyone's time.
>
>  
>




More information about the hackers mailing list