This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Change to lvalue casting in gcc v4.01


kenkahn@optonline.net writes:

> >>     char *buffer[1024];
> >>     *((uint32_t)buffer) = 0x1234;
> >
> >I don't believe that has ever been valid.
> 
> *SIGH* I meant to write
> 
>       char buffer[1024];
>       *((uint32_t)buffer) = 0x1234;
> 
> Is that better (and allowed)?

That doesn't make sense.  A uint32_t is not a pointer (at least, not
normally; you didn't actually show the typedef).  You can't indirect
through a non-pointer.

This is legal C:
    *((uint32_t *)buffer) = 0x1234;
and it is allowed.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]