in reply to Re^2: IC problem.[Solved, (feel free to reap)]
in thread IC problem.[Solved, (feel free to reap)]
Hmm, interesting. I also would have thought that in a union-type, all variables start at offset zero.
I thought i have seen it used something like this (pseudo-code, my C coding days are mostly over so i'm not really sure how this is all supposed to look): Image you want to have different IP records in memory, say,
Then you would be able to have an union type of both and access the first field ("type") to cast the variable to the the correct typedef?typedef struct { uint32 type; char ip[4]; } ipv4; typedef struct { uint32 type; char ip[16]; } ipv6;
As said, my C coding days are mostly over. But since i have some XS work coming up, i might as well start to think about such problems right now :-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: IC problem.[Solved, (feel free to reap)]
by BrowserUk (Patriarch) on Jun 12, 2015 at 14:04 UTC | |
by cavac (Prior) on Jun 12, 2015 at 14:11 UTC | |
by BrowserUk (Patriarch) on Jun 12, 2015 at 14:16 UTC |