<p>Of course, the immediate answer for most situations is <strong>"yes"</strong>, and I am a firm believer that a process should correctly cleanup any resources it has allocated, but what I have in my situation is a long-running system daemon that opens a fixed number of file descriptors at the startup, and closes them all before exiting.</p>

<p>This is an embedded platform, and I'm trying to make the code as compact as possible, while not introducing any bad style. But since file descriptors are closed before exit anyway, does this file descriptor cleanup code serve any purpose?  Do you always close all your file descriptors?</p>

man 3 exit:
```
```
....
All open stdio(3) streams are flushed and closed.  Files created by tmpfile(3) are removed.
```
```
So i believe leaving main effectively calls the exit function with main's return value. Though I would argue that it is bad style. Personally, I
always
explicitly free/close any acquired resources.