villemos
October 31st, 2002, 01:28 AM
Hey,
Yes, I know; Don't typecast!
But I came across an example in connection with another thread, where the properties of the typecast is used. Now, I get scared when I start to use the inplicit properties of C++ to get functionality.
So can anyone tell me if there are excact convensions for converting when typecasting, or if it is platform/compiler/vendor/whatever specific?
For example if I have
float value(1.99);
int integer = (int) value;
can I then count on "integer" always becomming 1? Will the decimal always just be stripped away or will some clever rounding be attempted somehwere (when the customer is standing with all the big bosses) and suddenly integer is 2?
Cheers,
villemos
Yes, I know; Don't typecast!
But I came across an example in connection with another thread, where the properties of the typecast is used. Now, I get scared when I start to use the inplicit properties of C++ to get functionality.
So can anyone tell me if there are excact convensions for converting when typecasting, or if it is platform/compiler/vendor/whatever specific?
For example if I have
float value(1.99);
int integer = (int) value;
can I then count on "integer" always becomming 1? Will the decimal always just be stripped away or will some clever rounding be attempted somehwere (when the customer is standing with all the big bosses) and suddenly integer is 2?
Cheers,
villemos