www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - end problem

↑ ↓ ← "Rajiv Bhagwat" <dataflow vsnl.com> writes:
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
↑ ↓ "Walter" <walter digitalmars.com> writes:
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
↑ ↓ "Rajiv Bhagwat" <dataflow vsnl.com> writes:
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> writes:
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