bug-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problems with function pointers.


From: Hotra, Jon
Subject: Problems with function pointers.
Date: Wed, 13 Dec 2000 14:23:18 -0600

I am using gcc version 2.8.1 on a Sun with the following system information:
bohr (169) --> uname -X
System = SunOS
Node = bohr
Release = 5.8
KernelID = Generic_108528-01
Machine = sun4u
BusType = <unknown>
Serial = <unknown>
Users = <unknown>
OEM# = 0
Origin# = 1
NumCPU = 12

I have been working with function pointers to Class Members, and the
compiler was acting rather screwy.  It was complaining about code that did
not contain errors, such as placing the function pointer typedef outside of
the class with a scoping on it.  Finally the compiler just broke with the
following code with the following error.

g++  -Wall -DEGR_PPU -DPOSE_PPU   -c occfunc.cpp -o occfunc.o
occfunc.cpp: In method `occFunc::occFunc()':
occfunc.cpp:31: Internal compiler error.
occfunc.cpp:31: Please submit a full bug report to
address@hidden'.
make: *** [occfunc.o] Error 1

header file
-------------

#ifndef OCC_FUNC_H
#define OCC_FUNC_H

class occFunc
{  
private:
    enum { MAX_NAME_SIZE = 30 };
    enum { MAX_JUMP_TABLE_SIZE = 50 };

    typedef void (occFunc::*pUnitFnc)(...);
    struct jumpTableNode 
    {
        char functionName[MAX_NAME_SIZE];
        pUnitFnc pFunction;
    };    
    jumpTableNode aJumpTable[ MAX_JUMP_TABLE_SIZE];
public:
    occFunc();
    void occf_clb_forward_( int old_pkt_len,
                                          int occ_len,
                                          int new_pkt_len,
                                          int occ_mcptr,
                                          int   *occ_fptr );
 };
#endif



.cpp file
-------------
#include "occfunc.h"
#include <iostream.h>
#include <string.h>

       
occFunc::occFunc()
{  
    cout << " occfFunc Constructor " << endl;
    ::strcpy(aJumpTable[0].functionName , "occf_clb_forward");
    occf_clb_forward_( 1, 1, 1, 1, 0);
    aJumpTable[0].pFunction = &occFunc::occf_clb_forward_;
// The next line of code causes the compiler error.
    aJumpTable[0].pFunction(1,1,1,1,0);
}


void occFunc::occf_clb_forward_( int old_pkt_len,
                                          int occ_len,
                                          int new_pkt_len,
                                          int occ_mcptr,
                                          int   *occ_fptr )
{
    cout << " !Grrr !" << endl;                 
}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]