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] |
Are we talking ISO C or GNU C here? This is OK for GNU C, and I think for POSIX.
> However i'm not targetting standard C
So why are you using -pedantic? -pedantic is only for strict ISO C.
... * The cast below is the correct way to handle the problem. * The (void *) cast is to avoid a GCC warning like: * "warning: dereferencing type-punned pointer will break \ * strict-aliasing rules" * which is wrong this code. (void *) introduces a compatible * intermediate type in the cast list. */ count -= got, *(char **)(void *)&buffer += size * got;
I'm not convinced this hackery is correct by my reading of ISO C, and in any case it's pointless. It could be replaced by:
count -= got, buffer = (char*)buffer + (size * got);
That's not for me to decide, not a language layer by any stretch of imagination.
-- vale
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |