Warnings on List.h (suggestion)

Corrado Giacomini c.giacomini____acresearch.com
Thu Apr 5 12:26:50 CEST 2001


I have downloaded  AGENT++ API Version 3.4.5 and compiled it, but at
compilation time my compiler, a
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) on RedHat
6.2, complains giving me a lot of warning messages
which I don't like.  Here they are...

../include/List.h:1198: warning: name lookup of `i' changed
../include/List.h:1192: warning:   matches this `i' under current ANSI
rules
../include/List.h:1193: warning:   matches this `i' under old rules

1191    int trim(int n) {
1192        int i=0;
1193        for (int i=0; i<n; i++) {
1194            T* t = removeLast();
1195            if (t) delete t;
1196            else break;
1197        }
1198        return i;
 1199    }

My Suggestion is the use the same  coding as the trim function at line
493 of the same List.h file and do something like:

    int trim(int n) {
                int i=0;
                for (; i<n; i++) {
                        T* t = removeLast();
                        if (t) delete t;
                        else break;
                }
                return i;
        }

Sorry  if I am paranoiac about warning messages.
Best regards,

-Corrado





More information about the AGENTPP mailing list