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

[leafnode-list] Compiler warnings (again)



This is a question for the C programmers out there.

The new activutil.c contains code like the following:

struct newsgroup {
    unsigned long first;
    unsigned long last;
    int alive;
    char * name;
    char * desc;
    time_t age;
};

struct newsgroup * active;	/* this should be an array of structs */

/* assume that active points to an array of structs, the last of which
   is fairly empty - i.e. all variables are set to 0 / NULL
   I now want to count the number of elements in this array
 */
int count( void ) {
    struct newsgroup * g;
    int i;

    g = active;
    i = 0;
    while ( g->name ) {
	i++;
	*(g++);		/* let g point to next element of array */
    }
    return i;
}

Unfortunately, gcc barfs on the *(g++); line with "warning: value
computed is not used".

What am I doing wrong?

--Cornelius.

-- 
/* Cornelius Krasel, U Wuerzburg, Dept. of Pharmacology, Versbacher Str. 9 */
/* D-97078 Wuerzburg, Germany   email: phak004@xxxxxxxxxxxxxxxxxxxxxx  SP4 */
/* "Science is the game we play with God to find out what His rules are."  */

-- 
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list