Enum tag inside another enum?
#1

Is there any possiblity of using a double-enum tag (I will provide an example below) without getting a tag mismatch error AND without having to put _: to clear it?

It's quite a stupid question as it is asked out of lazyness, but I'm just wondering.

Say you have a code like this:

pawn Код:
enum E_MY_ENUM
{
    E_DATA1,
    E_DATA2
};

enum E_MY_2ND_ENUM
{
    E_MY_ENUM:E2_DATA1,
    E2_DATA2
};

new
    MyVar[ E_MY_2ND_ENUM ]
;
I would then like to use it like this:

pawn Код:
MyVar[ E2_DATA1 ] = E_DATA2;
EDIT: I misspoke. That code above does NOT give me a warning, but if I try to print the data, then I do. I would like to be able to print out the value and use it as an integer, kind of.

Because of lazyness, I would like to not having to do so, but still don't get a tag mismatch warning.

I tried making a macro for it as a last resort (see below), but that crashed my compiler.

pawn Код:
#define MyVar _:MyVar
I also tried another way of doing it, by calling the variable something really... weird, then make a macro called MyVar to "mimic" that variable, but when I then assigned that variable I got another warning saying that the tag was being hidden:

pawn Код:
#define MyVar _:TESTVARIABLEIWILLNEVERUSETHENAMEOF

MyVar[ E2_DATA1 ] = E_DATA1;
Код:
warning 221: label name "_" shadows tag name
Any help would be appreciated!
Reply


Messages In This Thread
Enum tag inside another enum? - by LarzI - 19.03.2013, 11:44
Re: Enum tag inside another enum? - by Misiur - 19.03.2013, 12:19
Re: Enum tag inside another enum? - by LarzI - 19.03.2013, 12:22
Re: Enum tag inside another enum? - by Misiur - 19.03.2013, 12:25
Re: Enum tag inside another enum? - by LarzI - 19.03.2013, 14:10

Forum Jump:


Users browsing this thread: 1 Guest(s)