:? ??

Allan Sandfeld Jensen snowwolf@one2one-networks.com
Tue Mar 19 09:19:00 GMT 2002


Hi
I have just been fixing several files in KDE 3.0 so they compile using Sun's 
native compiler. The most frequent fix I had to make was the following case:

for some QString a:
QString b = (exp) ? "xyz" : a;

Now the sun compiler insisted the two types in ?: needs to be identical. Now 
I am wondering what on earth gcc is doing?
Is it doing: 
  (exp) ? QString("xyz") : a
or
  QString(exp ? "xyz" : (const char*)a);

in the case of QString it doesnt matter because it is reversable, but this is 
not always be the case! Shouldnt gcc atleast give a warning before doing an 
ambigous type-cast?

greetings
`Allan



More information about the Gcc mailing list