Variable
#4

Quote:
Originally Posted by kvann
Посмотреть сообщение
I did some not very thorough tests and from what I can see, enumerated arrays generate the same assembly (excluding the line numbers in comments) as their non-enumerated counterparts and there is no trace of the enum itself either. Here's a comparison of my test codes and their generated assemblies: https://www.diffchecker.com/E0TLWHpm
This is also explained somewhere in pawn-lang.dff, enums just exist for the compiler, basically all enum entries get replaced by indexes when compiling and the arrays are just regular arrays.
So having this enum:

Код:
enum E_TEST
{
e_val,
e_array[10]
};
new array[E_TEST];
will result in a 1D (not 2D) array with the size of 11 cells. e_val will be at index 0 and e_array at index 1 - 10.

So writing a string to e_array using strcat would result in something like this:

Код:
strcat(array[1], "mytext", 10);
This will write to the array beginning at index 1 with a size of 10 (11-1).
Reply


Messages In This Thread
Variable - by Alteh - 12.11.2018, 23:08
Re: Variable - by ReD_HunTeR - 12.11.2018, 23:13
Re: Variable - by kristo - 13.11.2018, 11:04
Re: Variable - by NaS - 13.11.2018, 14:39

Forum Jump:


Users browsing this thread: 1 Guest(s)