Test the following code:
#include
#include
main()
{
const char *yytext=\"0\";
const float f=(float)atof(yytext);
siz
This is no longer allowed according to C99 rules on pointer aliasing. Pointers of two different types cannot point to the same location in memory. The exceptions to this rule are void and char pointers.
So in your code where you are casting to a pointer of size_t, the compiler can choose to ignore this. If you want to get the float value as a size_t, just assign it and the float will be cast (truncated not rounded) as such:
size_t size = (size_t)(f); // this works
This is commonly reported as a bug, but in fact really is a feature that allows optimizers to work more efficiently.
In gcc you can disable this with a compiler switch. I beleive -fno_strict_aliasing.