Hi,
I have a piece of C++ code that can be compiled using g++, but reports an error when compiled with xlC:
xlC -DHAVE_CONFIG_H -I../SRC -I../include -DNoChange -DSPRNG_MPI -q64 -DLONG64=long -I/usr/lpp/ppe.poe/include -DLONG64=long -c -o libsprng_a-bignum.o bignum.cpp
"bignum.cpp", line 1280.8: 1540-0040 (S) The text "&" is unexpected. "ostream" may be undeclared or ambiguous.
The code segment is as below:
ostream& operator << (ostream& os, const BigNum& bn)
{
unsigned long int * ptr;
unsigned long int i = 1;
if (!bn.v)
return os;
ptr = bn.v + bn.Size() - 1;
os.setf(ios::uppercase);
os << hex << *ptr--;
while (i < bn.size) {
i++;
if \(NUMBITS == 32\)
os << setw\(8\) << setfill\('0'\) << hex << *ptr--;
else
os << setw\(16\) << setfill\('0'\) << hex << *ptr--;
}
os << endl;
// ptr = 0;
return os;
}