Sh wrote:

I'm trying to compile licq on Solaris build 24 x86 using sunstudio 11
c code compiles succesfully,but there are several problems with c++ code
For example,if we have a code like this
int n=5;
...
char ch[n];

then CC produces error: An integer constant expression is required within the 
array subscript operator.

CC is correct, the above is a gcc nasty.  Change int n=5 to const int n=5.

This can be solved by changing char ch[n]; to char *ch=(char *)malloc(n);

But there is another problem
in file user.cpp
line 3624:  m_fConf.ReadNum("SSTime", m_nSSTime, 0L);

"user.cpp", line 3624: Error: Could not find a match for 
CIniFile::ReadNum(const char[7], long, long) needed in ICQOwner::ICQOwner().

I don't know what the other parameter types are, but 0L is a long and the is no prototype expecting a long as the third parameter, try leaving it out (as it has a default) or using 0UL.

Here is some class in licq_file.h:
 bool ReadNum(const char *_szKey, unsigned long &data, const unsigned long 
_nDefault = 0);
 bool ReadNum(const char *_szKey, unsigned short &data, const unsigned short 
_nDefault = 0);
 bool ReadNum(const char *_szKey, signed short &data, const signed short 
_nDefault = 0);
 bool ReadNum(const char *_szKey, char &data, const char _nDefault = 0);

I tried g++ for this file and it's ok
So my question is what flag should I use to disable error with arrays and what 
kind of problem is with these functions?
Now I'm looking through docs.sun.com and manual pages but can't find the answers

Fix the sloppy coding that gcc accepts. This is the biggest problem porting code from other platforms that is built with gcc.

Ian
_______________________________________________
opensolaris-code mailing list
[email protected]
https://opensolaris.org:444/mailman/listinfo/opensolaris-code

Reply via email to