This is the mail archive of the
mailing list for the GCC project.
This has nothing to do with optimization.
This has something to do with the parser.
In C you can convert an expression of (nearly) any type to another type.
float f = (float) (&f);
Typecasting is dangerous. But sometimes you need typecasting.
Often you want to cast type A to type B.
C has only the possibity to cast any type to type B.
int x ;
float f ;
// p is a char*, but can also work with int-data from x, but never can work with float data)
char* p = (char*) x; // dangerous
char* p = (char*) f; // bug, but C can't determine that
char* q = (char*,int*) x; // explicit convering from int* to char*
char* q = (char*,int*) f; // compile time error
Especially if you are using macros this can be useful to determine bugs as
early as possible.
*p++ = (uint8_t,uint32_t)(word32 >> 8);
*p++ = (int,unsigned int) Bitstream_read (Res_bit[Res[Band].R]) - Dc[Res[Band].R];