[csw-maintainers] Error: Ambiguous "?:" expression
Philip Brown
phil at bolthole.com
Tue Mar 9 01:24:24 CET 2010
On Mon, Mar 8, 2010 at 3:40 PM, Jake Goerzen <jgoerzen at opencsw.org> wrote:
> "marked-up_text.cpp", line 222: Error: Ambiguous "?:" expression,
> second operand of type "surface" and third operand of type "int" can
> be converted to one another.
>
> the relevant part of marked-up_text.cpp (line 222) contains:
>
> return draw_text(gui != NULL ? gui->getSurface() : NULL, area,
> size, colour, txt, x, y, use_tooltips, style);
>
>
> Is there some syntax I can add/modify to this statement that will
> clear up the ambiguity the compiler is complaining about?
>
its a matter of guessing parenthesis.sss..sss
depending on how many args draw_text usually takes, I guess you want.. erm..
well, the simple way would be
return draw_text( (gui != NULL ? gui->getSurface() : NULL) , area,
size, colour, txt, x, y, use_tooltips, style);
I would guess.
this is actually a C question, not a C++ question, but the overloading
possibilities in C++ just make it more potentially confusing to figure
out the "correct" answer.
More information about the maintainers
mailing list