Re: defining big types on avr-gcc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Il giorno mer, 04/08/2010 alle 10.06 +0100, Andrew Haley ha scritto:

> > So why if I write:
> > big_dummy_t *p = (big_dummy_t*)0;
> > uint16_t p = (uint16_t)&(p->singledata);
> > 
> > I get NO warning?
> 
> Because the first is constant folded, the second isn't.  Not that it
> matters, because your program is undefined anyway, since you're
> dereferencing a null pointer.
I never read or write data poined by p. I only use it to calculate
offset of fields inside it.

I could write:
uint16_t p = (uint16_t)((char *)&(p->singledata) - (char*)0);

thanks



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux