Jump to content

Code layout - indentation


jl5501

Recommended Posts

Seeing some of the code that gets posted to this forum, I was wondering if some sort of preferred standard of indenation for readability should be promoted. 

 

I feel very strongly that some sort of formal indenting of code should be used and rigidly adhered to throughout ones code.

 

Personally I prefer the Allman or ANSI standard where opening and closing braces are placed on lines by themselves and are in vertical alignment, with the code block betweemn them indented.  Of course this leads to another well thrashed argument of how to indent. I prefer to use the tab, but I know there are strong advocates of a fixed number of spaces.

 

I have a dislike of the very popular style, from K&R C, of placing the opening brace at the end of a line. Personally I find code laid out like this, hard to read, but really I suppose the important thing is to be consistent in the standards you apply

 

I have been coding the way I do, for too many years to change the rigid standards I apply to my own code, but would be interested in hearing the views of the community here.

Link to comment
https://forums.phpfreaks.com/topic/192055-code-layout-indentation/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.