nmh-workers
[Top] [All Lists]

[Nmh-workers] Changing the return type of done()

2007-04-16 22:09:10
At the moment done() returns int, but it does this *only* because it is
used at the end of main()s as

return done (status);

Every definition of done() I've been able to find (it's overridden in
some compilation units) has the line

return 1;  /* dead code to satisfy the compiler */

at the end solely because of this calling context.

While it makes some sense to provide this dead code in main(), I believe
it is bad programming practice to hide it in a function that would not
otherwise contain it for any other reason.

I'd like to change done() to return void, and replace all the main()
calls with the two lines

done(status);
return 1;

I write "return 1;" there only because it's entirely equivalent to what's
currently in the code. All the done() implementations call exit(), so
the line should never be reached.

After 1.3 I'd prefer to replace this use of done() with some atexit()
registration, but does anybody have comments about the change I'm
proposing for the moment?

Thanks,

        - Joel


_______________________________________________
Nmh-workers mailing list
Nmh-workers@nongnu.org
http://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>