Hello There, Guest! Login or Register


Code Policy
#19
I'd say you use "n" rather than "i", for the very simple reason there's a major advantage of doing so: iterators. There's a reason "i" is always used in for loops...

Use the "i"-prefix for iterators and indexes; iLoop, i and iPlayerId in loops.
Use the "n"-prefix for numbers: nBankValue, nPlayerFlags and nPlayerId in functions and/or methods.

I kindof agree with the datatype argument; in normal hungarian notation there's a difference between four major types;

[table]
[tr][td]Size[/td][td]unsigned[/td][td]signed[/td][/tr]
[tr][td]1 byte (char)[/td][td]uc[/td][td]c[/td][/tr]
[tr][td]2 bytes (short)[/td][td]us[/td][td]s[/td][/tr]
[tr][td]4 bytes (int)[/td][td]ui[/td][td]i[/td][/tr]
[tr][td]8 bytes (long)[/td][td]ul[/td][td]l[/td][/tr]
[/table]

Pawn always is 32-bits. While it may seem obvious to use "i", seeing the Pawn integers are signed as well, the fact that even arrays ("new variable[256]" actually is 1 KB in size) are integers makes it confusing. Everything would be "i". Therefore I'd strongly suggest to differentiate between "i" (indexes/iterators) and "n" (numeric values). After all, floats are nothing else than casted integers in pawn either way (then again, strictly seen they always are).


Messages In This Thread
Code Policy - by Fireburn - 08-26-2009, 03:38 PM
Re: Code Policy - by Matthias - 08-26-2009, 05:02 PM
Re: Code Policy - by [Griffin] - 08-26-2009, 06:57 PM
Re: Code Policy - by Matthias - 08-26-2009, 07:00 PM
Re: Code Policy - by Jay - 08-26-2009, 07:59 PM
Re: Code Policy - by Wesley - 08-26-2009, 08:06 PM
Re: Code Policy - by Matthias - 08-26-2009, 08:12 PM
Re: Code Policy - by Wesley - 08-26-2009, 08:17 PM
Re: Code Policy - by Badeend - 08-27-2009, 12:28 AM
Re: Code Policy - by [Griffin] - 08-27-2009, 06:22 AM
Re: Code Policy - by Peter - 08-27-2009, 06:47 AM
Re: Code Policy - by Pugwipe - 08-27-2009, 01:18 PM
Re: Code Policy - by Felle - 08-27-2009, 06:09 PM
Re: Code Policy - by Fireburn - 09-05-2009, 10:52 PM
Re: Code Policy - by Jay - 09-06-2009, 12:24 AM
Re: Code Policy - by Pugwipe - 09-06-2009, 06:24 PM
Re: Code Policy - by Wesley - 09-07-2009, 07:30 PM
Re: Code Policy - by Pugwipe - 09-07-2009, 08:00 PM
Re: Code Policy - by Peter - 09-07-2009, 11:21 PM
Re: Code Policy - by Fireburn - 09-08-2009, 11:07 PM
Re: Code Policy - by [Griffin] - 09-09-2009, 03:30 AM