This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

[TUT] Enumerations (enum)


Post New Thread Reply   
 
Thread Tools Display Modes
Sherazaa
Member
Join Date: Jun 2012
Old 03-20-2013 , 14:33   Re: [TUT] Enumerations (enum)
Reply With Quote #91

No not really, i just learn Pawn enum
Thanks
__________________
[B]Bhop & Kz Player
Sherazaa is offline
Clauu
Senior Member
Join Date: Feb 2008
Location: RO
Old 05-13-2013 , 18:07   Re: [TUT] Enumerations (enum)
Reply With Quote #92

The compiler/parser is full of bugs, i don;t want to sound mean but until now i never had the chance to see something worst than this, if you declare a var called myvar then that name it can't be used anymore or worse if you use a macro such as define for that var it will cause an internal compiler error, get_user_name and similar natives throws an error at charsmax/sizeof for a struct data such as enum data{name[32]};new player[33][data];get_user_name(id,player[id][name],charsmax(player[id][name])-error expected token ] bla bla);
Also in enum you can;t have "name[32],myvar=0" it has to be inverse with arrays on the last line otherwise you will get a huuge error.
There is a need for some major updates and upgrades.

Last edited by Clauu; 05-13-2013 at 18:12.
Clauu is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-13-2013 , 18:11   Re: [TUT] Enumerations (enum)
Reply With Quote #93

Can you explain better with formated (use code bbcode) and concrete example of what is your problem exaclty ? For me it looks you just have a lack of knowledge on how works the enum for pawn.
__________________
Arkshine is offline
Clauu
Senior Member
Join Date: Feb 2008
Location: RO
Old 05-13-2013 , 18:20   Re: [TUT] Enumerations (enum)
Reply With Quote #94

1.
Code:
enum data_struct {
name[32]
};

public myfunction() {
new name[32]; // compiler error
}

#define name "a" // now the compiler 'dies' directly with an internal error and crashes
2.
Code:
enum data_struct {
name[32],
num=0 // compiler error, switching num with name and keeping arrays on the last line is fine when assigning default values
};
3.
Code:
enum data_struct {
name[32]
};
new player[33][data_struct];

public myfunction(id) {
get_user_name(id,player[id][name],charsmax(player[id][name])); // compiler error at charsmax/sizeof
}

Last edited by Clauu; 05-13-2013 at 18:27.
Clauu is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-13-2013 , 18:37   Re: [TUT] Enumerations (enum)
Reply With Quote #95

All are expected. You have to remember it's only pseudo-structures. It's kind of an hack around the enum to allow such "structure". Pawn != C.

1. You can't do that. It works like that in Pawn. It's unrelated to enum.

2. Remove the = 0 you can't set value directly here and it doesn't make sense anyway to do that since you create a "structure".

3. Expected. Right syntax : charsmax(player[][name]).
__________________

Last edited by Arkshine; 05-13-2013 at 18:38.
Arkshine is offline
Clauu
Senior Member
Join Date: Feb 2008
Location: RO
Old 05-14-2013 , 03:10   Re: [TUT] Enumerations (enum)
Reply With Quote #96

So if those are pawn limitations and not parser errors then it's really bad.. ok i understand it's only just a game scripting language but c'mon those situations are critical for programing and damn it data structures it's a must in these times.

Last edited by Clauu; 05-14-2013 at 03:10.
Clauu is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-14-2013 , 03:50   Re: [TUT] Enumerations (enum)
Reply With Quote #97

Quote:
Originally Posted by Clauu View Post
So if those are pawn limitations and not parser errors then it's really bad..
It's bad that there are no bugs?????? You must have some convoluted views of the world. All languages have their own limitations for a reason (otherwise the language wouldn't exist).
__________________

Last edited by fysiks; 05-14-2013 at 03:51.
fysiks is offline
Clauu
Senior Member
Join Date: Feb 2008
Location: RO
Old 05-14-2013 , 05:03   Re: [TUT] Enumerations (enum)
Reply With Quote #98

Yes indeed some languages have their own limitations but not such critical things, the general idea of all languages is to evolve right? From my point of view these things can easily be fixed and i'm pretty sure that i'm not the only one who stumbled with these issues.
Clauu is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 05-14-2013 , 05:17   Re: [TUT] Enumerations (enum)
Reply With Quote #99

Each language is different, that is why there are so many of them out there. If every language had the same features, then what would be the point of having so many languages to choose from? Last I checked, Pawn was created be easily embedded and not resource intensive. It was never designed to be as robust as other languages. These limitations you claim are bad were created by design. Yes some languages evolve, but they all evolve within the same limitations they were created with. If you believe some of the limitations need to be fixed, go bug CompuPhase since they are the developers of Pawn. Just note that AMXX is unlikely to incorporate any new features they add to Pawn. I do not know what version of Pawn is used by AMXX, but I highly doubt it is the latest
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-14-2013 , 05:21   Re: [TUT] Enumerations (enum)
Reply With Quote #100

That's not issues. It's how works Pawn. Check the introduction http://www.compuphase.com/pawn/pawn.htm. Also there is no point to compare Pawn to other languages and requesting features/way of working from them. Each languages have its differences. Deal with them for Pawn.
__________________
Arkshine 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 22:10.


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