Hi,
in what environment is the incrementation-part (3rd part) of a
for loop executed?
Or, is the following example valid C++ ? (g++-4.2.2 doesn't accept it)
struct Auto_Type;
typedef Auto_Type *Auto_ptr;
struct Auto_Type {
Auto_ptr next;
};
int main() {
Auto_ptr Head = 0, Tail= 0;
// (Verarbeiten,) Ausgabe und Löschen der Elemente
for ( Auto_ptr Auto= Head; Auto; Auto= Auto_next ) {// valid ?
Auto_ptr Auto_next= Auto->next; // <<<<<<<<<< defined only now
delete Auto;
}
}
Many thanks for your comment,
Helmut Jarausch
Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany
--
[ See http://www.gotw.ca/resources/clcm.htm
for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]