This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
General practices
- From: Steven Abner <pheonix dot sja at att dot net>
- To: newlib at sourceware dot org
- Date: Mon, 16 Sep 2019 12:14:18 -0400
- Subject: General practices
Need some help:
I've gone through several of libgloss crt0 files, normally create code
on the mac, love the editor!
Seen that Newlib has switched to 'FreeBSD' style FILE unit.
With the basic intro out of the way... the question is: from _start to
main(), the normal 'return' from
main() dumps you back to _start from which I assume Newlib has a
standard expected termination
of the process. Correct assumption? And is this expectation that of
calling the 'exit' function?
The reason for this question is that the APPLE FreeBSD style does call
'exit' which allows for clean
up, such as flushing files, calling atexit(), etc. and lunix does not
allow for such a clean up using
'return' from main(). Maybe I just misunderstand the 'C' process?
Thanks in advance, and hopefully down the road I can offer up a
smaller, embedded type FILE unit,
if I can work out the return vs. exit clean up. Not sure people want to
stop using return for exit just
to flush stdout.
Steve