Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 598865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:26:10+00:00 2026-05-13T16:26:10+00:00

Inside my atexit() registered function I would like to get the exit status (either

  • 0

Inside my atexit() registered function I would like to get the exit status (either the argument to exit(3) or what main() returned with).

Is there any portable way of doing this? Is there any GNU libc specific way of doing it such as a global holding that value I can reference?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T16:26:10+00:00Added an answer on May 13, 2026 at 4:26 pm

    Here’s a hack:

    // hack.c
    int last_exit;
    
    // hack.h
    extern int last_exit;
    #define exit(x) (exit)(last_exit = (x))
    

    Won’t work for return, but, hey, it’s portable!

    On a more maintainer-friendly note, you may want to consider writing some form of wrapper to do something similar to this for you. Hacking around how GCC implements exit() sounds like a maintenance nightmare. Better to write a few helper functions that exit for you, and maybe even mask them with macros if you’re into that kind of thing. With a macro you might even be able to replace return calls, if you always call return with parenthesis. Though this sounds like even more of a maintenance nightmare.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Inside my .aspx I have some JSON code that looks like this: function someFunctionName()
Inside the initialize() function there is a jQuery each loop. Inside that loop is
Inside my controller how would i get the base URL. for example, if my
Inside class, I would like to define some const strings.however the compiler reports error
// inside $(document).ready function... var name = ''; function test() { $.post('/student/get-info', function(data) {
Inside Gmail, there is a small function called Task. It can allow me to
Inside a maven project, I would like to use some classes that were already
Inside a tabpanel, there is an object like this: tabpanel.counter = 3; Inisde the
Inside of the functions.php file, is there a way to get a custom post
Inside the project folder there is a project's name folder, Release and Debug folder.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.