C language question
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    ausPPC
    Posts: 543 from 2007/8/6
    From: Pending...
    There's a prototype for exit() defined in stdlib.h but where can I find the complete macro or function definition?
    PPC assembly ain't so bad... ;)
  • »19.05.14 - 01:23
    Profile Visit Website
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    ausPPC
    Posts: 543 from 2007/8/6
    From: Pending...
    https://en.wikibooks.org/wiki/C_Programming/C_Reference/stdlib.h/exit

    I get the impression that, on MorphOS, exit() is a macro that has some connection to Dos.library Exit() but I'm still interested to know where this is actually defined.

    [ Edited by ausPPC 19.05.2014 - 09:38 ]
    PPC assembly ain't so bad... ;)
  • »19.05.14 - 01:38
    Profile Visit Website
  • MorphOS Developer
    jacadcaps
    Posts: 3146 from 2003/3/5
    From: Canada
    Quote:

    ausPPC wrote:
    There's a prototype for exit() defined in stdlib.h but where can I find the complete macro or function definition?


    You won't find a definition, because it's in a linked lib, already compiled and not available in source form.

    Also, if you're targeting MorphOS or any other amigaoid system, using exit() is the wrong approach.

    [ Edited by jacadcaps 19.05.2014 - 06:50 ]
  • »19.05.14 - 07:49
    Profile Visit Website
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    ausPPC
    Posts: 543 from 2007/8/6
    From: Pending...
    Fair enough. From the searches I did, exit() seemed like generic C. Although I fell down this little rabbit hole via SDK:Examples/MUI/demo.h
    PPC assembly ain't so bad... ;)
  • »19.05.14 - 12:11
    Profile Visit Website
  • MorphOS Developer
    bigfoot
    Posts: 510 from 2003/4/11
    exit() is indeed a standard C library routine, but the problem is that you very easily end up using it wrong if you do use it, and using it at all can compromise the design of your software.

    So yes, you can use exit(). But unless you're very careful, you'll end up with a buggy program.
    I rarely log in to MorphZone which means that I often miss private messages sent on here. If you wish to contact me, please email me at [username]@asgaard.morphos-team.net, where [username] is my username here on MorphZone.
  • »19.05.14 - 14:43
    Profile Visit Website