On 13 May 2009, at 15:16, Тимофей Даньшин wrote:

Hi there.

Here is a C++ constructor that is said to work on Windows (i.e., the guy who wrote it says it works on Win), but doesn't work on Mac. Is there a way to fix it, except by replacing it with a "copy" method?

Cbyte1::Cbyte1 (Cbyte1 &val) {
        m_size = val.m_size;
        if (m_size == 0) {
                m_totalmax = 0;
                b = "";
                return;
        }
}

Hi Timofey,

This isn't really a Cocoa question, so this isn't really the right list to be asking.

That said, the rules about which constructor (or for that matter function) gets chosen are very complicated. It may be that there are implicit conversions going on that mean that the compiler can't decide which of the constructors to use (for instance, if there happened to be a conversion method from Cbyte1 to an "int", you might have the problem you're seeing).

The solution is most likely to add the keyword "explicit" to some of the constructors, or to remove the conversion method (assuming it exists).

Kind regards,

Alastair.

--
http://alastairs-place.net



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to