Quote:
Originally Posted by SnoW
Umm... Maybe I understood wrong, but where was the inefficiency? The both ways should equal and one shouldn't be more efficient than one.
|
Okay... let me put this very simply. Which one of these takes longer to type?
Clearly, the first one does. Thus, if you cannot justify the extra work, using semicolons is inefficient. Multiply this by a few hundred times for any reasonable plugin, or a few thousand times for any big one, and you have a massive inefficiency problem here which is significantly bigger than the arguably inefficient explicit initialization of looping variables and iterators.
Quote:
Originally Posted by SnoW
Many will agree with you, but I guess many will agree with me as well, maybe the ones who use semicolons? It's maybe more readable for me as I've got used to it, but I don't see why I need there a reason. It's just how it is. Somehow I don't see a reason how using start assigment would be any readable to the people who use it.
|
All action requires a reason or it is irrational. The readability was not my point in the first place; I was just stating that it's not as readable as you think in response to your claim that it looks nicer.
As for the initialization, I already explained that it can be more readable (although I don't do it) since it's clearly stating what a variable will contain without implying it and without costing any extra resources or introducing backwards compatibility problems.
Quote:
Originally Posted by SnoW
But you can't many in a single line. Which I think in following situation when using "everyone know statement", looks even better than in two lines.
PHP Code:
new Float: health; pev( index, pev_heath, health ); //...
|
That is terrible programming and is one of the first things that they teach you
not to do in computer science/programming/electrical/whatever 101.
I mean, we can detag floats like this to use them as integers:
PHP Code:
new Float:temp
temp = Float:get_user_frags( id )
client_print( id, print_chat, "Your frags are %d", temp )
But is this really a good idea? Would you really come to the conclusion, based on the code I have given above, that detagging incorrectly tagged variables is good/useful just because we can do it? Of course you wouldn't.
Quote:
Originally Posted by SnoW
It can actually be that the first lang in I used semicolons was pawn. You could compare the extra work to adding a "g" before global variables or even naming variables with long names just to make the code readable. This is still what you do as well I believe.
|
This is a terrible comparison. Tagging variables with "g" is actually useful as it provides information that you can't see on first glance without it. I automatically know where the end of a line is without a semicolon, but if I'm looking through a block of code that is unfamiliar, I won't know what is global and what isn't. Giving variables long names is also nothing like using semicolons; it again provides useful information that you won't find on first glance without it. So no, what you're saying is not what I believe.
__________________