Hi ,
��� I am new to this mailing list. I am currenty invovled in one assignment.That assignments deals �about porting one application on Mac Os X.
I am running program correctly on Linux but it gives the problem on Mac Os X
�
xyz.h
class xyzFlavor
{
public:
xyzFlavor& operator= (const xyzFlavor& flavor);
xyzFlavor operator+ (const xyzFlavor& flavor) const;
xyzFlavor toString();
private:
xyzFlavor(const Uint32 flavor);
� Uint32 cimFlavor;
static const xyzFlavor NONE ;
const xyzFlavor OVERRIDABLE ;
const xyzFlavor ENABLEOVERRIDE;
const xyzFlavor TOSUBCLASS ;
const xyzFlavor TOINSTANCE ;
const xyzFlavor TRANSLATABLE� ;
const xyzFlavor TOSUBELEMENTS ;
const xyzFlavor DISABLEOVERRIDE;
const xyzFlavor RESTRICTED ;
const xyzFlavor DEFAULTS ;
};
xyzFlavor.cpp
const xyzFlavor xyzFlavor::NONE = 0;
const CIMFlavor xyzFlavor::OVERRIDABLE = 1;
const xyzFlavor xyzFlavor::ENABLEOVERRIDE = 1;
const xyzFlavor xyzFlavor::TOSUBCLASS = 2;
const xyzFlavor xyzFlavor::TOINSTANCE = 4;
const xyzFlavor xyzFlavor::TRANSLATABLE = 8;
const xyzFlavor xyzFlavor::TOSUBELEMENTS = TOSUBCLASS + TOINSTANCE;
const xyzFlavor xyzFlavor::DISABLEOVERRIDE = 16;
const xyzFlavor xyzFlavor::RESTRICTED = 32;
const xyzFlavor xyzFlavor::DEFAULTS = OVERRIDABLE + TOSUBCLASS;
xyzFlavor::xyzFlavor ()
���� : cimFlavor (xyzFlavor::NONE.cimFlavor)
{
}
xyzFlavor::xyzFlavor (const CIMFlavor & flavor)
���� : cimFlavor (flavor.cimFlavor)
{
}
xyzFlavor & xyzFlavor::operator= (const xyzFlavor & flavor)
{
���� this->cimFlavor = flavor.cimFlavor;
���� return *this;
}
xyzFlavor xyzFlavor::operator+ (const xyzFlavor & flavor) const
{
���� return xyzFlavor(this->cimFlavor | flavor.cimFlavor);
}
String xyzFlavor::toString () const
{
��� String tmp;
�
��� if (this->hasFlavor (xyzFlavor::OVERRIDABLE))
������� tmp.append("OVERRIDABLE ");
�
��� if (this->hasFlavor (xyzFlavor::TOSUBCLASS))
������� tmp.append("TOSUBCLASS ");
�
��� if (this->hasFlavor (xyzFlavor::TOINSTANCE))
������� tmp.append("TOINSTANCE ");
�
��� if (this->hasFlavor (xyzFlavor::TRANSLATABLE))
������� tmp.append("TRANSLATABLE ");
�
��� if (this->hasFlavor (xyzFlavor::DISABLEOVERRIDE))
������� tmp.append("DISABLEOVERRIDE ");
�
��� if (this->hasFlavor (xyzFlavor::RESTRICTED))
������� tmp.append("RESTRICTED ");
�
��� if (tmp.size ())
������� tmp.remove (tmp.size () - 1);
�
��� return tmp;
}
test.cpp
static const xyzFlavor xyzFlavor_ALL = xyzFlavor::OVERRIDABLE +
���� xyzFlavor::TOSUBCLASS + xyzFlavor::TOINSTANCE +
xyzFlavor::TRANSLATABLE +
���� xyzFlavor::DISABLEOVERRIDE + xyzFlavor::RESTRICTED;
void main()
{
��� xyzFlavor f4 = xyzFlavor (xyzFlavor_ALL);
�
�������cout << "\n----------------------\n";
�������cout << "f4: " << f4.toString ()�;
����
��� assert (f4.toString () ==
�� "OVERRIDABLE TOSUBCLASS TOINSTANCE TRANSLATABLE DISABLEOVERRIDE RESTRICTED");
���
}
On Linux I am getting exact value of xyzFlavor_ALL but on Mac Os X , I am�getting zero.After running the code on Mac Os X ,it gives the assert . So I am not getting that how the operator overloading and static global declaration work?
Can any one tell me why i am getting the value of xyzFlavor_ALL = 0?
�
Regards
Girish
�
Are you running the same version of gcc on both linux and mac systems? (gcc --version) The latest version for the mac is 3.3
[james-gibbs-computer:~] jgibbs% gcc --version
gcc (GCC) 3.3 20030304 (Apple Computer, Inc. build 1495)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
James
