Re: [TUT] Code Styling
Quote:
This is obviously problematic because you either have to never use bools or just not tag them as being bools. This is a bad precedent because you now have similar problems with floats. For example, in a set_task() call, the third parameter is a standard cell: PHP Code:
I used to use HN and I thought it was great for a few months. Some of my scripts are still using it, actually. But I really started turning away from it when I began developing APIs. Its major downfall, as far as I'm concerned, is that it discourages good variable naming. For example, I might use "i" as an iterator but according to HN it might be "iI". What if it's a global pointer to a handle for a null terminated string? As crazy as that sounds, I've had things like that before. The tag would look something like "g_phsz" which is just ridiculous and confusing. If you decide not to tag that as such, you are inconsistent. That's why I suggest only tagging globals and pointers. Quote:
The point is, though, that if you detag a pointer, you're going to get useless data. If you detag a bool, you're going to get a cell which is just as useful. That's more what I was talking about. Quote:
Quote:
Quote:
Quote:
Technically, the only correct tag would be g_iTest, but since the data it stores is useless without first passing it into get_pcvar_<x>(), it's a bad idea to tag it as what it actually is. |
Re: [TUT] Code Styling
Quote:
|
Re: [TUT] Code Styling
Quote:
|
Re: [TUT] Code Styling
Very nice thread. I agree with everything.
By the way, i have a question about semicolons. I know it has been discussed before, but i don't understand what is actually doing. Let's say, i have a code with no identition wich ignores you advices (tabs, spaces, brackets, etc.. ). If i put "#pragma semicolon 1" it will automatically make identitation or what ? sorry for asking without testing. |
Re: [TUT] Code Styling
Quote:
Well if semicolon is in 1 You need to close all lines with ; Example without semicolon PHP Code:
PHP Code:
PHP Code:
|
Re: [TUT] Code Styling
Ahh...thanks.
PS: it closes automatically or i have to do that? |
Re: [TUT] Code Styling
Quote:
You need to closes all lines execpts "if( )" "{ }" and blank lines, others like params you need to put the ( ; ) to Closes. EDIT: For new, static lines you need to... You dont new for lines that you open { } Example public somethin(x) // Here no. { // } |
Re: [TUT] Code Styling
I know you're anti - bots, but i know that. I've asked something else.
However, i do understand know. |
Re: [TUT] Code Styling
Quote:
|
Re: [TUT] Code Styling
Quote:
|
All times are GMT -4. The time now is 17:13. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.