c++ - end problem
- "Rajiv Bhagwat" <dataflow vsnl.com> Aug 23 2001
- "Walter" <walter digitalmars.com> Aug 23 2001
- "Rajiv Bhagwat" <dataflow vsnl.com> Aug 24 2001
- "Walter" <walter digitalmars.com> Aug 24 2001
This is really a 'c' problem, but since there is no 'c' newsgroup, it is
here.
This code segment has 2 problems:
1. 'any_bullshit' does not cause a syntax error. (Both for 'c' and 'cpp').
2. If this is saved as 'test.c', optlink gives an error about 'end'. If -mn
is specified, optlink crashes. If the file is saved as 'test.cpp', it
encounters no errors and even runs.
----------
#include <stdio.h>
void end(void *data, const char *el) {
}
int main( any_bullshit ) {
printf("Hello from Test1\r\n");
return 0;
}
------------
Seems like 'end' is special for DMC 'c'. The code piece is minimal runnable
segment from an Expat sample, which uses 'end' as the handler for tag ends
in a 'c' program, so other C compilers don't seem to have 'end' as a
reserved routine. In any case, Optlink should not crash.
Aug 23 2001
You're right, it conflicts with a name in the runtime library, and the conflict also causes optlink to crash. -Walter Rajiv Bhagwat wrote in message <9m30qt$2b7s$1 digitaldaemon.com>...This is really a 'c' problem, but since there is no 'c' newsgroup, it is here. This code segment has 2 problems: 1. 'any_bullshit' does not cause a syntax error. (Both for 'c' and 'cpp'). 2. If this is saved as 'test.c', optlink gives an error about 'end'. If -mn is specified, optlink crashes. If the file is saved as 'test.cpp', it encounters no errors and even runs. ---------- #include <stdio.h> void end(void *data, const char *el) { } int main( any_bullshit ) { printf("Hello from Test1\r\n"); return 0; } ------------ Seems like 'end' is special for DMC 'c'. The code piece is minimal runnable segment from an Expat sample, which uses 'end' as the handler for tag ends in a 'c' program, so other C compilers don't seem to have 'end' as a reserved routine. In any case, Optlink should not crash.
Aug 23 2001
What about main() not complaining about arbitrary symbol? Not a show stopper, but the compiler should catch that error as well. -- Rajiv Walter <walter digitalmars.com> wrote in message news:9m4k36$aaq$1 digitaldaemon.com...You're right, it conflicts with a name in the runtime library, and the conflict also causes optlink to crash. -Walter Rajiv Bhagwat wrote in message <9m30qt$2b7s$1 digitaldaemon.com>...This is really a 'c' problem, but since there is no 'c' newsgroup, it is here. This code segment has 2 problems: 1. 'any_bullshit' does not cause a syntax error. (Both for 'c' and
2. If this is saved as 'test.c', optlink gives an error about 'end'.
is specified, optlink crashes. If the file is saved as 'test.cpp', it encounters no errors and even runs. ---------- #include <stdio.h> void end(void *data, const char *el) { } int main( any_bullshit ) { printf("Hello from Test1\r\n"); return 0; } ------------ Seems like 'end' is special for DMC 'c'. The code piece is minimal
segment from an Expat sample, which uses 'end' as the handler for tag
in a 'c' program, so other C compilers don't seem to have 'end' as a reserved routine. In any case, Optlink should not crash.
Aug 24 2001
That gets declared as an int. Isn't C lovely? <g> Rajiv Bhagwat wrote in message <9m5gev$1q5i$1 digitaldaemon.com>...What about main() not complaining about arbitrary symbol? Not a show stopper, but the compiler should catch that error as well. -- Rajiv Walter <walter digitalmars.com> wrote in message news:9m4k36$aaq$1 digitaldaemon.com...You're right, it conflicts with a name in the runtime library, and the conflict also causes optlink to crash. -Walter Rajiv Bhagwat wrote in message <9m30qt$2b7s$1 digitaldaemon.com>...This is really a 'c' problem, but since there is no 'c' newsgroup, it is here. This code segment has 2 problems: 1. 'any_bullshit' does not cause a syntax error. (Both for 'c' and
2. If this is saved as 'test.c', optlink gives an error about 'end'.
is specified, optlink crashes. If the file is saved as 'test.cpp', it encounters no errors and even runs. ---------- #include <stdio.h> void end(void *data, const char *el) { } int main( any_bullshit ) { printf("Hello from Test1\r\n"); return 0; } ------------ Seems like 'end' is special for DMC 'c'. The code piece is minimal
segment from an Expat sample, which uses 'end' as the handler for tag
in a 'c' program, so other C compilers don't seem to have 'end' as a reserved routine. In any case, Optlink should not crash.
Aug 24 2001








"Walter" <walter digitalmars.com>