Clean up; - Printable Version +- Las Venturas Playground (https://forum.sa-mp.nl) +-- Forum: Main Talk (https://forum.sa-mp.nl/forum-3.html) +--- Forum: Development (https://forum.sa-mp.nl/forum-16.html) +--- Thread: Clean up; (/thread-12454.html) |
Clean up; - tomozj - 09-14-2008 I think if we are to clean up the code, it might be a better idea to set out some guidelines? I've seen some of your comments Jay, and personally I dislike this format: Code: //comment lala I don't like too much spacing, but it can be a little harder to read. The // should be seperated from the comment itself as follows in my opinion: Code: // Comment lala .. cleaner. Another thing I haven't quite picked up on with you, but I think we should have some kind of syntax we use.. Personally I like the following: Code: if(expression) { There's a space between the ) and {, but the last } is not indented with the code (as I have seen in some old chunks of LVP), meaning it's easy to see where things start and end. Any suggestions? Re: Clean up; - Badeend - 09-16-2008 It's much easier to read if a { is on the next line. Also a space between if and ( and spaces around 'expression' will be cleaner imo. Result: Code: if ( expression ) Re: Clean up; - dab - 09-16-2008 psh of course, I always try to upload my code as neat as possible on svn. On another note, the whole { on its own line is argued by programmers all over the world I personally like having it on the line of the statement. As tomozj displayed. [me=dab]looks at Badeend[/me] Re: Clean up; - Pugwipe - 09-16-2008 (09-16-2008, 03:02 AM)Badeend link Wrote: Also a space between if and ( and spaces around 'expression' will be cleaner imo.For me it all depends on what the condition looks like. For example: Code: if (number >= 6) Code: if (number >= aNumbers[index]) Code: if ( number >= aNumbers[ index ] ) Re: Clean up; - tomozj - 09-16-2008 I find too much spacing frustrating - I want to be able to get right at the code without a bunch of spaces in the way. Personal taste here as pointed out, but I find spacing at array indexes quite annoying, and I usually strip them from my code. I tend to like adding the opening bracket on a new line if it's a function header, but otherwise it's a meh. Whatever works, I've just seen some awful stuff in old code recently like this: Code: if(expression){ Really confusing to read, meh. Apart from the spacing at the array positions, I don't mind other syntaxes mentioned. Meh. |