Tail recursion vs exceptions vs C++
Iain McClatchie
iain@truecircuits.com
Fri Oct 24 23:19:00 GMT 2003
I cannot compile the following one-line program without
disabling exceptions. Fails for both GCC 3.2.2 and 3.2.1.
int main() { main(); }
Use the command line:
gcc tail.cc
Note that if the C compiler is used rather than the C++
compiler, GCC succeeds. egcs-2.91.66 (that's the old Red
Hat release) works, if that matters.
queue21 (try) [6] % gcc tail.cc
/tmp/ccgYrf4b.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
queue21 (try) [7] % gcc --version
gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
...
% /usr/local/gcc3.2.1/bin/gcc tail.cc
/tmp/ccwq3zf9.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
% /usr/local/gcc3.2.1/bin/gcc --version
gcc (GCC) 3.2.1
...
% /usr/local/gcc3.2.1/bin/gcc -fno-exceptions tail.cc
% gcc -fno-exceptions tail.cc
%
-Iain McClatchie iain-5@truecircuits.com
650-691-7604 voice
True Circuits, Inc. 650-691-7606 FAX
650-703-2095 cell
More information about the Gcc
mailing list