Emmanuel Delahaye said:
Mark wrote on 15/07/05 :
Garbage ? Thanks...
OK, a little harsh, sorry.
Linker error ?
This code is designed to test code (like the one posted by people I try to
help on the forums.
It happens that some of this code can be strange (to me), like having
several return from main() or a lot of exit()'s spread out. This is the
way I found to handle that. If you have a better solution, I'd be glad to
see it.
I've already given you the suggestion, here it is again:
The solution would be to rename your 'main()' function
calling it something intuitive, such as init_testlib();
Then when you want to help someone, you can still copy and paste their code
and need only to add 1 line to the main() function (a call to
init_testlib(argc, argv)
As for multiple return statements and calls to exit... it makes no
difference to your
library as you have registered yourself with the atexit() function... you
don't perform
ANY calculations or do a cleanup of any sort when main returns control to
you!
Should you have such a requirement in the future, I'd suggest creating
another
function to perform the post-run tasks.
Regards,
Mark