var cos, min; min = 3 cos = min + 1 show_message(string(cos))To me this doesn't sound like a smart move. Is the advent of GM:Studio a good time to start disallowing this, alongside the other bad practices that are already taken care of?
Now is a good time to start disallowing this
Started by Erik Leppen, Mar 11 2012 03:19 PM
5 replies to this topic
#1
Posted 11 March 2012 - 03:19 PM
It seems that it's possible to have variables with the same name as built-in functions.
#2
Posted 11 March 2012 - 03:31 PM
o.O I wasn't even aware of that...
#3
Posted 11 March 2012 - 07:06 PM
C++ runner should be able to notice the difference between those two, right?
#4
Posted 11 March 2012 - 07:22 PM
I..why would you even do that?
#5
Posted 11 March 2012 - 07:28 PM
It's not a question of wanting to do that, it's a question of happening to do that, or accidently doing that.I..why would you even do that?
I don't WANT to not initiallize variables, but should I forget or mistype a variable name, I want an error message.
#6
Posted 11 March 2012 - 08:15 PM
Fortunately, the color-coded editor flags these names. Unfortunately, it doesn't disallow their use. But you must admit, it can lead to some interesting looking code:
sin = pi/2;
cos = sin(sin);
abs = -abs(-1);
abs = abs(abs);
exp = exp(cos(sin)/abs);
sin = pi/2;
cos = sin(sin);
abs = -abs(-1);
abs = abs(abs);
exp = exp(cos(sin)/abs);
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











