String handling on VAC compiler (version 5) on AIX

String handling on VAC compiler (version 5) on AIX

Post by Ken Darmod » Sat, 09 Dec 2000 23:09:51



Hi,

I am having a problem upgrading from the old ibmcxx compiler to the
visual age 5 compiler on AIX.
The problem is with a string definition which defines
an indefinite length string as follows:

static char _ET_script_[] =
"\n"
"\n"
";#\n"
......
Lots more additions to the char string
.....
"\n"
"\n"
"";

The resultant string is very long, and produces the following compiler error

"oc.cc", line 246.1: 1540-0872 (S) A string literal cannot be longer than
32765
characters.

This code passed the old compiler without complaint.    So my question is
this :  Is there any way to instruct the visual age compiler to adjust its
limit on the length of a string literal, so that this statement would pass?

Thanks in advance,

Ken.

 
 
 

1. Template handling on VAC 5.0 compiler.

I posted the following on the ibm.software.vacpp.compiler
group a few weeks ago, but there seems to be little or no traffic
over there.    So, I was hoping maybe someone over here could help.

I have encountered a compile problem with template handling using
VAC 5.0.

This is code which has already been successfully compiled on
about 10 other platforms, but doesn't get past this compiler.     I've tried
all the obvious ways to solve this, but it's a bit stubborn.    If anyone is
familiar with the problem, I would welcome some pointers.

The basic problem concerns a member function of a template class.
The relevant snippets of the template definition are.

template<class T, int max>
class MySeq
{
public:

    typedef MySeq<T,max> tempParamType;
    DECLARE_MEMORY(tempParamType)

    ....  other declarations etc.

    static void                                 freebuf(T* p);

    .....  etc.

The function freebuf is declared in the same file as

template<class T, int max>
inline void
MySeq<T, max>::freebuf(T* buffer)
{
        if (buffer)
        {
        int     nelems  = vec_size(buffer);
        char            *       spp             = (char*)buffer;

                for (int i = nelems; i > 0; i--)
                {
                       ((T*)spp)->T::~T();       // Compiler fails on these
2 lines - see below
                        spp += sizeof(T);
                        .......etc.
                 }
         ......... etc.

I have taken the irrelevant bits out of the above for clarity.
When I instantiate the MySeq template, say with class X,
I get 2 errors (for the 2 lines indicated in the for loop above) :

The first is :
The "->" operator cannot be applied to the undefined class "class X".

The second is:
The use of undefined class "X" is not valid.

Basically, anywhere within freebuf that T is referenced produces an error.
The class X is definitely known at the point of instantiation (I have
double-checked this),
but the compiler seems to think it isn't.     I assume it is an error in the
above
definitions, but I have not as yet been able to track it down.
I have also looked at the VAC 5.0 guides extensively, but they have provided
no
clues.

Any help greatly appreciated,

Ken Darmody.

2. msg for Tai-Min ( Denny ) Chou

3. AIX C 3.1.4 compiler generated executables not portable to older AIX Versions

4. NEC MultiSync 2A > XF86Conf

5. Exception Handling with Sun's Workshop Compiler Version 6 Update 2

6. YDL 2.0, PowerMac 5500 instller

7. void * not handled in AIX C compiler ?

8. Caching problems ...

9. Can I install VAC++ and Compilers?

10. vac.C vs xlccmp Compilers

11. Question #2 - Different versions of kernel modules compile using vac

12. VisualAge Vac C++ version 5.0

13. AIX 4.3.1 Compiler version 3.6.4