[Scummvm-devel] Re: advanced C++ foo breaking GCC 2.95 again
Max Horn
max at quendi.de
Wed Dec 15 16:33:04 CET 2004
Am 15.12.2004 um 12:25 schrieb Jonathan Gray:
> g++ -Wp,-MMD,"saga/.deps/actionmap.d2" -Wall -g -Wno-long-long
> -Wno-multichar -Wno-unknown-pragmas -pedantic -Wpointer-arith
> -Wcast-qual -Wconversion -Wshadow -Wimplicit -Wundef
> -Wnon-virtual-dtor -Wno-reorder -Wwrite-strings -fcheck-new
> -Wctor-dtor-privacy -DHAVE_CONFIG_H -DUNIX -DDISABLE_KYRA -I. -I.
> -I./common -I./backends/midi/mt32 -I/usr/local//include
> -I/usr/local//include -I/usr/local//include -I/usr/local//include
> -I/usr/local//include -I/usr/local/include/SDL -D_REENTRANT
> -Itest/cxxtest -c saga/actionmap.cpp -o saga/actionmap.o
> In file included from saga/list.h:25,
> from saga/text.h:29,
> from saga/saga.h:38,
> from saga/actionmap.cpp:25:
> common/list.h: In method `T2 & Common::List<T>::Iterator<T2>::operator
> *() const':
> common/list.h:86: `Node' is not a template
> common/list.h:86: warning: ANSI C++ forbids declaration `' with no type
> gmake: *** [saga/actionmap.o] Error 1
>
> The nested templates scare me and I don't fully understand the code.
I assume with "nested templatess" you refer to the "struct Node". Well,
simply put, that's just a way of saying: hey, this List class deals
with type "T" (e.g. "int"), but it can also be assigned values of type
"T2" (e.g. float) as long as they can be cast to type "T".
In this case, the templates are used in their most basic forms: as
generic types. Types T and T2 are placeholders for arbitrary types. To
understand the code, just imagine the "template" keyword was gone and
all occurance of T and T2 replaced by int...
> Potential workarounds/solutions?
Personally I don't see supporting GCC 2.95 as a goal. It's old outdated
compiler supporting a language which resembles C++ but isn't C++.... if
we can do it with little effort, I don't mind, but that's it.
Just my two cents.
Max
More information about the Scummvm-devel
mailing list