On Fri, 21 May 2010 04:23:55 +1000 David Seikel <onef...@gmail.com> said:

> /me tries to sort out the mix of top and bottom posting, with
> misquotes, and just throws most of it away for clarity.
> 
> On Thu, 20 May 2010 14:27:45 +1000 Carsten Haitzler (The Rasterman)
> <ras...@rasterman.com> wrote:
> 
> > it is indeed a shortcut. i could use printf with %p instead - but i
> > was just avoidng adding a full struct/object there that would
> > normally be the case when querying values from it. is imply used the
> > pointer itself as a quick shortcut to keep the code small and
> > focused. in any normal situation it'd be a void * to your original
> > data struct that you'd probe/fetch values from etc.
> 
> If it's an example, people will copy it, might be best to do things the
> right way?

its a useless example. if you are copying that you havent created anything of
use at all. as such though - it is legal to store an int in a pointer as long
as:

1. you are on a sane architecture (were pointers are simply numbers). efl
doesnt work on any arch that isnt like that anyway. such archs are dead and
buried.
2. int is smaller or equal to pointer size (any arch efl works on is this way).

all architectures of any sanity that efl runs on meet these requirements. in
all cases i know of pointers are as big OR bigger than ints (as such - reality
is that char == 8bit, short == 16bit, int == 32bit, void * == 32bit OR 64bit.
long == 32bit OR 64bit, long long == 64bit, etc. - architectures where this
doesn't work will break with efl anyway.. and for that matter will break with
mountains of software, so everyone makes their c compilers work this way).

storing ints in pointers is actually fine - as technically pointers are just
integers (integer numbers). the only problem is fitting size. same with all
variables. if i were to loop and add more than 4 billion genlist items - the
int would overflow and loop anyway. (well unsigned. int would loop to negative
after 2 billion)

-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    ras...@rasterman.com


------------------------------------------------------------------------------

_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to