SA-MP Forums Archive
Tag mismatch - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Tag mismatch (/showthread.php?tid=640532)



Tag mismatch - Misiur - 03.09.2017

This is not an easy question. I need someone with deep compiler knowledge, to explain to me what is happening under the hood.

Working:

pawn Код:
#include <a_samp>

enum E_TEST {
    E_WTF[32]
}

main () {
    new name[] = "Just a name";
    new test[E_TEST];
    strcat((test[E_WTF][0] = '\0', test[E_WTF]), name);
}
Failing

pawn Код:
strcat(((test[E_WTF])[0] = '\0', test[E_WTF]), name); // Warning: tag mismatch
I'm using some really contrived macros and I need the version in brackets to work. I just don't understand why it's not an compiler error, and just a tag mismatch error. Adding tags does not change anything, that's why I'm asking compiler magicians to explain to me the process which is happening here. Thank you


Re: Tag mismatch - Misiur - 03.09.2017

Shorter example:
pawn Код:
(test[E_WTF])[0] = EOS;



Re: Tag mismatch - Paulice - 04.09.2017

No clue as to what outcome you expected, nor if you expected it to work. But it would only be logical if you wrapped the whole thing, although I don't know why you would want to do that in this case.


Re: Tag mismatch - kAn3 - 04.09.2017

I've compiled it right now, nothing happened:



Re: Tag mismatch - Paulice - 04.09.2017

You must compile:
PHP код:
strcat(((test[E_WTF])[0] = '\0'test[E_WTF]), name); // Warning: tag mismatch 
Or:
PHP код:
(test[E_WTF])[0] = EOS



Re: Tag mismatch - kAn3 - 04.09.2017

Quote:
Originally Posted by Paulice
Посмотреть сообщение
You must compile:
PHP код:
strcat(((test[E_WTF])[0] = '\0'test[E_WTF]), name); // Warning: tag mismatch 
Or:
PHP код:
(test[E_WTF])[0] = EOS
eheheh sorry I wasn't paying attention yesterday :c
By the way, you may probably already know it, but
Код:
        strcat(((test[E_WTF][0]) = '\0', test[E_WTF]), name);
        (test[E_WTF][0]) = EOS;
doesn't show up the tag mismatch warning. Doing this
Код:
(test[E_WTF][0])[1] = EOS;
gives the tag mismatch warning aswell. But if we do
Код:
new playerid[1];
(playerid)[0] = 1;
Compiler won't complain. Maybe the warning shows up because the E_WTF belongs to an enum? Indeed,
Код:
new playerid[E_TEST];
(playerid)[0] = 1;
shows up the warning.


Re: Tag mismatch - JasonRiggs - 04.09.2017

the bracket around the word? I mean have you tried (playerid[0])?


Re: Tag mismatch - Misiur - 04.09.2017

Alright, as VVwVV pointed out
pawn Код:
(test[E_WTF])[E_TEST:0] = EOS;
works. What I don't understand is why
pawn Код:
(_:test[E_WTF])[0] = EOS;
does not work

https://github.com/Zeex/pawn/issues/182
For now I compiled the compiler with the warning turned off, as the code works except for all the tag mismatch warnings