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

C++ question



Hi, 
	I have posted this to comp.lang.c++, but hope someone here can
	help me as well. Thanks.

=====================
        I have a c++ program that compiles fine with
        earlier version of g++, but it no longer compiles with
        the newsest release 2.95.2.

        Here is the relevant bit of code:

        typedef struct List
        {
                void            **hd;   /* first item */
                void            **cr;   /* current item */
                void            **tl;   /* last item */
                void            **mx;   /* max item before growing is required */
                int             grow_size;
        } List;

        Some macros defined:

        #define fast_list_first(l)      ((l && l->hd)? *(l->cr = l->hd) : 0)
        #define fast_list_last(l)       ((l && l->hd)? *(l->cr = l->tl) : 0)

        And a Function like this:
        void lfree(List *l)
        {
                void *item;
                for (item=fast_list_first(l); item != NULL; item=fast_list_last(l))
###->>>>                delete item;
        }


        When compiled with g++(2.95.2), it failed with this:
        [line 55 is the line marked with arrows above]
        % g++ -g -c misc.c
        misc.c: In function `void lfree(List *)':
        misc.c:55: warning: `void *' is not a pointer-to-object type

        It gives me the warning message, but no .o file is created, and
        if I put it in a makefile, it results:
        % make misc.o
        g++ -g -c misc.c
        misc.c: In function `void lfree(List *)':
        misc.c:55: warning: `void *' is not a pointer-to-object type
        make: *** [misc.o] Error 1


        Thanks for any help in advance.

Shao.


-- 
____________________________________________________________________________
Shao Zhang - Running Debian 2.1  ___ _               _____
Department of Communications    / __| |_  __ _ ___  |_  / |_  __ _ _ _  __ _ 
University of New South Wales   \__ \ ' \/ _` / _ \  / /| ' \/ _` | ' \/ _` |
Sydney, Australia               |___/_||_\__,_\___/ /___|_||_\__,_|_||_\__, |
Email: shao@cia.com.au                                                  |___/ 
_____________________________________________________________________________


Reply to: