Compilation problem on HPI-Itanium - HP UX

This is a discussion on Compilation problem on HPI-Itanium - HP UX ; Hi, I am porting the following piece of code from HP PARIC to HP-Itanium. The following piece of code compiles on HP-PARISC(aCC: HP ANSI C++ B3910B A.03.50) without any problem. But gives the following error on HPI(aCC: HP aC++/ANSI C ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Compilation problem on HPI-Itanium

  1. Compilation problem on HPI-Itanium

    Hi,
    I am porting the following piece of code from HP PARIC to HP-Itanium.
    The following piece of code compiles on HP-PARISC(aCC: HP ANSI C++
    B3910B A.03.50) without any problem. But gives the following error on
    HPI(aCC: HP aC++/ANSI C B3910B A.05.52 [Jan 16 2004]).

    /project/as10g/src/build101201/src32_m1q/or$>aCC -AP -c TableLook.cpp
    Error 195: "TableLook.cpp", line 15 # Static member "const TabNameLook
    (*TableHandle::mpObjNames)[]" was declared as 'const
    TabNameLook (*)[]' in class yet has type 'const TabNameLook (*)[]'
    here.
    const TabNameLookArray* TableHandle::mpObjNames = (const
    TabNameLookArray*)ObjNames;


    -------
    TableLook.h
    #include
    #include

    class TabNameLook
    {
    public:
    // Constructor
    TabNameLook(const char *s, int n){}

    char* mName; // Table name
    int mNum; // Table name index
    };


    typedef TabNameLook TabNameLookArray[];


    class TableHandle
    {
    public:
    static const TabNameLookArray* mpObjNames;

    };
    ----------------------------
    TableLook.cpp

    #include "TableLook.h"


    const TabNameLook ObjNames[] =
    {
    TabNameLook("aa1",1),
    TabNameLook("aa2",2),
    TabNameLook("aa3",3),
    TabNameLook("aa4",4),
    TabNameLook("aa5",5),
    TabNameLook("aa6",6),
    TabNameLook("aa7",7),
    };

    const TabNameLookArray* TableHandle::mpObjNames = (const
    TabNameLookArray*)ObjNames;

    Does anybody have any idea as about resolving this problem. I am not
    able to understand as to why the compiler on HPI is not able to compile
    this.


  2. Re: Compilation problem on HPI-Itanium

    sathyanarayana.singh@gmail.com wrote:
    : But gives the following error on
    : (aCC: HP aC++/ANSI C B3910B A.05.52 [Jan 16 2004]).

    It seems the IPF aCC5 compiler was broken.
    This works fine on aCC6 (A.06.00) or PA's aCC3.

    : Error 195: # Static member "const TabNameLook
    : (*TableHandle::mpObjNames)[]" was declared as 'const
    : TabNameLook (*)[]' in class yet has type 'const TabNameLook (*)[]' here.

    (They look the same to me. ;-)

    This seems like CR JAGad98269:
    Error 195 on template static member definition that is an array

    but that was fixed and it was with templates.

    : typedef TabNameLook TabNameLookArray[];
    : const TabNameLookArray* TableHandle::mpObjNames = (const
    : TabNameLookArray*)ObjNames;

    Any reason you are doing this cast? This is taking a pointer to
    TabNameLook and casting it to a pointer to a pointer to TabNameLook.

    : Does anybody have any idea as about resolving this problem.

    The workaround is to use a pointer instead of the array:
    typedef TabNameLook *TabNameLookArray;

+ Reply to Thread