Skip to content

Return code from main ignored #23

Description

@paulhankin

The return code from main using libsupcxx is not the same as calling exit, at least in linux-x86_64-libsupcxx . Specifically, sys::exit(1) (which calls the C function exit(1)) causes a shell exit status of 1, whereas "return 1;" from an initial call to main leads to a shell exit status of 0.

Note, the C standard says:
5.1.2.2.3 Program termination

  1. If the return type of the main function is a type compatible with int, a return from the
    initial call to the main function is equivalent to calling the exit function with the value
    returned by the main function as its argument.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions