tagof(_:) crashes the compiler and a potential compiler bug or I am bugged
#1

Using tagof(_: ) crashes the compiler.
Is this by any chance a compiler bug?Or I just don't know how to check if a variable is tagless.

Compiling this code won't give any warning.Moreover it gives the wrong output when executed.

Код:
new Float:a=123.2,b =5;
MyFunc(a,b);
b is tagless and the compiler is supposed to issue me a warning for tag mismatch but it doesn't.On top of that, when the code is executed.It says "Float Float".How is a tagless variable having a Float tag?

Код:
stock MyFunc({Float,bool}:var1,{Float,bool}:var2,tagid1 = tagof(var1),tagid2 = tagof(var2))
{
	if(tagid1 == tagof(Float:))
	{
	    if(tagid2 == tagof(Float:))
	    {
			print("Float Float");
	    }
	    else if(tagid2 == tagof(bool:))
	    {
            print("Float Bool");
	    }
	    else
	    {
	        print("Ahhh...you are a bad programmer.You ignored the compiler's tag mismatch warning!!!");
	    }
	}
	else if(tagid1 == tagof(bool:))
	{
	    if(tagid2 == tagof(Float:))
	    {
            print("Bool Float");
	    }
	    else if(tagid2 == tagof(bool:))
	    {
            print("Bool Bool");
	    }
	    else
	    {
	        print("Ahhh...you are a bad programmer.You ignored the compiler's tag mismatch warning!!!");
	    }
	
	}
	else
	{
	    print("Ahhh...you are a bad programmer.You ignored the compiler's tag mismatch warning!!!");
	}
}
Reply
#2

Swap the tags.
pawn Код:
MyFunc({bool,Float}:var1,{bool,Float}:var2,tagid1 = tagof(var1),tagid2 = tagof(var2))
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)