Page 1 of 1
about sizeof(struct st)..
Posted:
Sat Apr 24, 2010 5:03 am
by linjichao
i try to get sizeof a self-define struct type, but i confuse about result...
example,
typedef struct st
{
char* name;
struct st* next;
}ST;
sprintf(text, "result is:%d", sizeof(ST));
result is:0x18
why??? it should 0x8,isn't?
Re: about sizeof(struct st)..
Posted:
Sat Apr 24, 2010 7:47 am
by akr
You cant rely on that. Its about structure alignment of the compiler / interpreter. Different systems will give u always different values.
Andreas
Re: about sizeof(struct st)..
Posted:
Sat Apr 24, 2010 9:58 am
by linjichao
how can i get the sizeof the struct ?
is there have any way to do?
Re: about sizeof(struct st)..
Posted:
Sat Apr 24, 2010 3:47 pm
by makslane
Are you trying to port for 64bits?
Re: about sizeof(struct st)..
Posted:
Wed Apr 28, 2010 4:02 pm
by linjichao
32 bits
i have another question...
there have any way to translate function pointer where define in ge script to build-in function in ge?
Re: about sizeof(struct st)..
Posted:
Wed Apr 28, 2010 4:26 pm
by makslane
The functions defined in the script are not compiled in native instruction codes.
So, you can't call using a function pointer.
If you are compiling the normal 32bit version, I think the wrong struct size can be a bug of the script engine.