Hello There, Guest! Login or Register


Conclusion
#5
(02-14-2011, 12:26 PM)Jay link Wrote: In what circumstances would these parameters not be constant darling? Please elaborate here.
When data is passed on to the function? I doubt all players will have the same name and the same password. It seems pretty useless to make function parameters constant. I've never seen anyone do that in any language.

(02-14-2011, 12:26 PM)Jay link Wrote: In no instance should the function modify any of these variables.
Using initialisers allows for more efficient compiling.
I strongly doubt this is the case. It seems silly to make a constant of what once was a variable, this isn't even possible in some languages. In C++ (or C#), try setting a constant to a variable which isn't known at compile-time. I'm not sure about PHP but I doubt it's possible there and it doesn't seem like good coding practice to me.

(02-14-2011, 12:26 PM)Jay link Wrote: Whilst it may be better coding practice to prefix functions with lowercase letters in other languages, SA-MP's syntax is different to this and would complicate matters if we changed it now.
Then why do I see "The names of all variables functions and methods should start with a lowercase letter, all subsequent words must have their first letter capitalized." in your coding policies?

(02-14-2011, 12:26 PM)Jay link Wrote: Again not only is it better coding practice to prefix variable names with a single lowercase letter to indicate the variable type but it makes future reference much easier. It is pretty obvious that the sPlayerMessage variable is a string given the s prefix.
Please Google Hungarian notation, if you know what it is, re-read your post. And I know it's a string, but what would it contain? A message about a player? A message to be output to the player? A message set by the player?
Reply


Messages In This Thread
Conclusion - by Jay - 02-14-2011, 12:06 AM
Re: Conclusion - by xBlueXFoxx - 02-14-2011, 07:06 AM
Re: Conclusion - by Matthias - 02-14-2011, 07:35 AM
Re: Conclusion - by Jay - 02-14-2011, 12:26 PM
Re: Conclusion - by Matthias - 02-14-2011, 05:56 PM
Re: Conclusion - by Jay - 02-14-2011, 10:48 PM
Re: Conclusion - by Matthias - 02-15-2011, 07:09 AM
Re: Conclusion - by Jay - 02-18-2011, 06:50 PM