N
Nils Petter Vaskinn
Why is it that if I have an overloaded function like:
void foo(int i);
void foo(char *c);
I can't do:
void bar() {
foo( condition ? 5 : "NULL");
}
As you might guess I'm building a query and my compiler (g++) complaines
about different operands to ?:
While I can easily replace the ?: with an if I was surprised that the
statement wasn't allowed. So I wondered if this really is specified in the
standard (or a quirk of g++) and there is any good reason for it to be
that way.
Anyone care to enlighten me?
regards
NPV
void foo(int i);
void foo(char *c);
I can't do:
void bar() {
foo( condition ? 5 : "NULL");
}
As you might guess I'm building a query and my compiler (g++) complaines
about different operands to ?:
While I can easily replace the ?: with an if I was surprised that the
statement wasn't allowed. So I wondered if this really is specified in the
standard (or a quirk of g++) and there is any good reason for it to be
that way.
Anyone care to enlighten me?
regards
NPV