Consider this simple code:
int foo = 4;
double d1 = sin (foo);
double d2 = foo * 0.1;
When i compile this with gcc, the results are as expected (i.e. mathematically correct), even though sin()
expects a double
as its argument. It appears gcc has implicitly casted foo
to double
.
How portable is this kind of implicit casting, what are the limitations, where can I find documentation?
Side note: I do know C++ compilers are required to handle such casting correctly.