Problems with enumerated strings
#8

Quote:
Originally Posted by ******
Посмотреть сообщение
I'll try and explain what your code is ACTUALLY doing by giving you equivalent code:

pawn Код:
new vector[34];
#define a 0
#define b 2
Those are the values that "a" and "b" take, vector becomes a big array with you indexing things, however as you've seen already there is some extra checking in the compiler to prevent you assigning to the array directly. What this does mean is that you can actually fit a 34 character string into "vector[a]", it will just overwrite the contents of "vector[b]". I have actually used this trick in the past. Also of interest is the fact that enum items are the only things which you can assign both standard numbers and arrays (strings) to - this is another trick I've used in some unreleased code to make a function which can take either a single id or an array of ids.
Thanks for the explanation ******, I wasn't aware that is how enumeration was handled, now it's making a lot more sense, I should've looked into this before replying with invalid information. Apologies for that RSX.
Reply


Messages In This Thread
Problems with enumerated strings - by RSX - 14.01.2011, 21:49
Re: Problems with enumerated strings - by Retardedwolf - 14.01.2011, 21:52
Re: Problems with enumerated strings - by DeadAhead - 14.01.2011, 21:54
Re: Problems with enumerated strings - by JaTochNietDan - 14.01.2011, 21:57
Re: Problems with enumerated strings - by RSX - 14.01.2011, 21:57
Re: Problems with enumerated strings - by JaTochNietDan - 14.01.2011, 22:11
Re: Problems with enumerated strings - by RSX - 14.01.2011, 22:40
Re: Problems with enumerated strings - by JaTochNietDan - 15.01.2011, 03:30
Re: Problems with enumerated strings - by RSX - 15.01.2011, 14:34
Re: Problems with enumerated strings - by Goldkiller - 16.01.2011, 20:29

Forum Jump:


Users browsing this thread: 1 Guest(s)