F
Flo
I have the problem, that the following Code produces neither warning
nor error at compile time, at least not with the Microsoft Visual C++
6.0 compiler (warning level 4)
enum E { eOne, eTwo };
struct S {
void fooDouble( double ) {};
void fooEnum( E ) {};
};
int main() {
S s;
s.fooDouble( eOne ); // neither warning nor error
return 0;
}
As you can see, accidentally an enum is passed to the method expecting
an double. In my real program, this leads to an error at run-time,
since fooDouble only accepts quit small values, i.e. values smaller
than 1.0. Has anybody an idea what I can do, maybe changes in the
methodnames/parameterlist, to provoke a warning at compile time so one
can not accidentally pass an enum to the method expecting a double?
Flo
Flo
nor error at compile time, at least not with the Microsoft Visual C++
6.0 compiler (warning level 4)
enum E { eOne, eTwo };
struct S {
void fooDouble( double ) {};
void fooEnum( E ) {};
};
int main() {
S s;
s.fooDouble( eOne ); // neither warning nor error
return 0;
}
As you can see, accidentally an enum is passed to the method expecting
an double. In my real program, this leads to an error at run-time,
since fooDouble only accepts quit small values, i.e. values smaller
than 1.0. Has anybody an idea what I can do, maybe changes in the
methodnames/parameterlist, to provoke a warning at compile time so one
can not accidentally pass an enum to the method expecting a double?
Flo
Flo