Question about enums -
NeXoR - 20.11.2016
Hey there, does an enumerator use memory ?
Or is it really just similar to a define
Re: Question about enums -
AndySedeyn - 20.11.2016
-Wrong-
Re: Question about enums -
Nero_3D - 20.11.2016
No they aren't stored in memory
An enum is just an easy way to create a list of tagged / untagged constants
Re: Question about enums -
BiosMarcel - 20.11.2016
Quote:
Originally Posted by Nero_3D
No they aren't stored in memory
An enum is just an easy way to create a list of tagged / untagged constants
|
Actually that's wrong, all variables are stored in ram(Or in some cases in the CPU cache? dunno) , even the code is, how else would you have the speed that you need, obviously not by storing variables on hard drive.
Re: Question about enums -
SickAttack - 20.11.2016
Quote:
Originally Posted by [Bios]Marcel
Actually that's wrong, all variables are stored in ram(Or in some cases in the CPU cache? dunno) , even the code is, how else would you have the speed that you need, obviously not by storing variables on hard drive. ![Smiley](images/smilies/smile.png)
|
They aren't variables. Enumerator = iterator/list of consecutive constants. Enumerators don't store values. You can do pInfo:6, just like 6. But you can't give a tag to that specific index without an enumerator.
So you're the one that's wrong.
-
BiosMarcel - 20.11.2016
but where is it stored if not in the memory? All information has to be stored somewhere not just variables, so explain pls
Or do u mean that they are replaced on compiletime?
Re: Question about enums -
SickAttack - 20.11.2016
Enumerators are the same as macros. Variables with assigned enumerators are the ones storing things.
P.S. Double posting isn't allowed. Use the edit button.
Re: Question about enums -
BiosMarcel - 20.11.2016
u didn't get my point i think ^^ what i meant was, that not only values are be stored (depending on how u define stored).
Re: Question about enums -
SyS - 20.11.2016
no they are just constant values and not variables .They are not saved in the memory
Re: Question about enums -
Kaliber - 20.11.2016
There get replaced from the pre-compiler to constants..for example:
PHP код:
//Before pre-compiler
enum x
{
a,
b
};
new test[x];
test[a] = 5;
test[b] = 6;
//After pre-compiler
new test[2];
test[0] = 5;
test[1] = 6;