The reason why it looks like you could cram larger values into the variable is dead simple and lies in the roots of C. C is statically typed meaning that all type information is only available at compile time so the compiler can pick the right commands to work with the data. At runtime the type data isn't needed and the code just runs the same commands no matter what you give it as input.

Consider this function:
Code:
void foo(int bar)
{
   printf("Hey, the passed parameter is a int and it is: %i", bar);
}



Now we call the function, lets say like this: foo(23);
You can imagine what it prints, right?

Now consider this here:
Code:
STRING *baz = "HAHA, suck that";
...
foo((int)baz);



The compiler won't complain because you explicitly told it that you know that an int is expected, you gave no int but everything is perfectly right (there are various legit reasons to allow this). Anyway, it won't magically print your string but interpret the pointer to the string you passed it as an int resulting in the printf printing the address of that pointer...


So, back to what you did: You changed that data type to int, now the compiler sees that there is an int expected where previously you had a var. To get this clear, this doesn't change the struct at all as the engine is already compiled to expect var! The header is just their so the compiler knows what you mean with eg. camera->clip_factor, so that it knows at which memory address it can get the data. If you change it, you alter the commands your program runs, not the one the already compiled engine runs.
So now that you changed this to an int, the compiler will do implicit typecasting. So if you pass a var or a size_t whereas the data type is an int, it will typecast it for you (this works only in some cases where the signdes doesn't change and the data types have the same size). Anyway, you will now see an int and you can print an int, but the engine still uses var so it interprets the value other than you do.

Hope this clarifies the whole issue so far.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com