Raised This Month: $51 Target: $400
 12% 

AMXX Compiler stuck


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 12-08-2014 , 17:17   AMXX Compiler stuck
Reply With Quote #1

Hello guys.
Can any of you test if this code gets your compiler stuck? I am using 1.8.2 compiler on Linux (Lubuntu 14.10):
PHP Code:
#define regex_compile(%0)            _:regex_compile(%0) 
If anyone wonders why am I even doing this, it is because I want to get rid of tag casting ("retagging"?), because my enum structure looks like:
PHP Code:
enum E_REWRITE
{
    
m_pattern,
    
m_flags,
    
m_message[MAX_MESSAGE_LENGTH 1]
}; 
So I don't have to put _: in before regex_compile() and Regex: in before variable name while passing m_pattern member to other Regex functions.

There is actually another workaround which compiler accepts:
PHP Code:
native regex_compile_notag(const pattern[], &reterror[], maxLen, const flags[]="") = regex_compile;
#define regex_compile(%0)            regex_compile_notag(%0) 
but I don't think it is worth doing it.

Again, this is all just to get rid of tag casting... Because I am lazy, and I find tag casting very untidy and stupid.

Last edited by klippy; 12-08-2014 at 17:19.
klippy is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-08-2014 , 17:31   Re: AMXX Compiler stuck
Reply With Quote #2

Oh come one, just tag your member.
__________________
Arkshine is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 12-08-2014 , 17:34   Re: AMXX Compiler stuck
Reply With Quote #3

Like this?
PHP Code:
enum E_REWRITE
{
    
Regexm_pattern,
    
m_flags,
    
m_message[MAX_MESSAGE_LENGTH 1]
}; 
Or in the code itself (when using variable)? Because the thing above doesn't work in Pawn, which I hate, and that is the reason I am doing this.

Last edited by klippy; 12-08-2014 at 17:34.
klippy is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-08-2014 , 18:03   Re: AMXX Compiler stuck
Reply With Quote #4

Ah, sorry. Yeah, it's kind of buggy. It seems that tag at right will try to match tag on the variable holding m_pattern member and not that member. So you need to untag.
Will check if something can be done for that. Meanwhile yeah you can use a macro or your another workaround but sounds like you're wasting a lot of time for nothing \o/.
__________________

Last edited by Arkshine; 12-08-2014 at 18:05.
Arkshine is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 12-08-2014 , 18:09   Re: AMXX Compiler stuck
Reply With Quote #5

Well macro doesn't work, so I will go with the other one.
Well anyway, thank you for your time.
klippy is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-08-2014 , 18:25   Re: AMXX Compiler stuck
Reply With Quote #6

You can actually use a trick with the magic any tag, like that:

Code:
enum E_REWRITE {     m_pattern,     m_flags,     m_message[256] }new any:Data[E_REWRITE]; Data[m_pattern] = regex_compile("Something");

Since the check is done on Data, now you can set what you want which is tagged, it should not throw a tag mismatch.
You can tag as well m_pattern or not with Regex:, it doesn't matter, this would be just for consistency/readability.
__________________

Last edited by Arkshine; 12-08-2014 at 18:30.
Arkshine is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 12-08-2014 , 18:55   Re: AMXX Compiler stuck
Reply With Quote #7

Oh, that is awesome, thank you! I totally forgot about the any: tag.
Anyway, will that compiler bug (is it a bug?) be fixed in the future versions, preferably 1.8.3?
klippy is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-13-2014 , 05:59   Re: AMXX Compiler stuck
Reply With Quote #8

This behavior has always annoyed me and got curious. Long story short, after some research and testing several compiler of old AMXX versions, I've found issue has been introduced in AMXX 1.60 (!). It's about a regression from a fix and since then until now, no one has asked "why the hell I need to add a _:". \o/

It should be fixed in latest build. If you want more information, see https://github.com/alliedmodders/amxmodx/pull/164. Compatibility should be kept (meaning old plugin using _:).
__________________

Last edited by Arkshine; 12-13-2014 at 06:00.
Arkshine is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 12-13-2014 , 06:45   Re: AMXX Compiler stuck
Reply With Quote #9

That you for fixing it. That thing annoyed me for a while now.
klippy is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:23.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode