[lug] An unusual C construct

Bruce Long qstream at gmail.com
Thu Jul 29 00:05:37 MDT 2010


On Wed, Jul 28, 2010 at 11:46 PM, David Morris <lists at morris-clan.net>wrote:

> On Wed, Jul 28, 2010 at 22:57, Kenneth D Weinert <kenw at quarter-flash.com>
> wrote:
> >
> > sizeof(((tCLAIM_tbl_def *)0x0)->acHealth_Service_Id)
> >
> > tCLAIM_tbl_def is a structure typedef.
> >
> > I understand the intent of this code - it's to get the size of the
> > field in the tCLAIM_tbl_def structure so the equivalent field in the
> > current structure (not shown) can be the same size.
> >
> > It's just that in all my years of coding C I've never seen this
> > technique used. It does work, at least on the AIX compiler we're using
> > here.
> >
> > I'll also note that it's hard to google - at least I've not come up
> > with the correct search terms to find an explanation.
> >
>

You have posed another interesting problem: how would one find the answer
with Google? The closest I have come is "static c sizeof cast null pointer
0x0" But the answer still wasn't there and I had to know the answer in order
to come up with that search string! Hmmmm...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20100729/268e61f3/attachment.html>


More information about the LUG mailing list