Re: Ambiguous conversions
Re: Ambiguous conversions
- Subject: Re: Ambiguous conversions
- From: Laurence Harris <email@hidden>
- Date: Thu, 22 Jun 2006 22:15:55 -0400
On Jun 22, 2006, at 6:50 PM, Mark Wagner wrote:
Since converting a project from CodeWarrior to XCode, the compiler's
been notifying me about ambiguous conversions.
Example code (oFileName is a MFileName object, derived from the
MString class):
if('.' == oFileName[i])
The message:
ISO C++ says that these are ambiguous, even though the worst
conversion for the first is better than the worst conversion for the
second:
../MODEL/MString.h:148: note: candidate 1: const wchar_t&
MString::operator[](long int) const
/DEVELOPMENT xcode/TGEQ/TGEQ.prj/../MODEL/MEXAM.CPP:254: note:
candidate 2: operator[](const wchar_t*, int) <built-in>
Under CodeWarrior, these didn't even generate a warning. Under Xcode
1.5/gcc 3.3, the compiler gave a warning, but compiled anyway. Xcode
2.3/gcc 4.0 gives an error: "ISO C++ says that these are ambiguous,
even though the worst conversion for the first is better than the
worst conversion for the second". Should I be worried that attempting
to compile this under XCode 2.5/gcc 4.1 will cause my computer to
explode?
More seriously, how do I solve this? Is there something I can change
in the function prototype, or do I need to go through the code and
change the thousands of lines that trigger this error?
I am a fanatical user of named constants, so I have this in a header
that's included in my pch:
const
UniChar kPeriod = 0x002EU;
I do this since everything *I* do with character constants like this
involves working with UTF-16 characters, so no conversions are required.
Larry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden