Keith Thompson wrote:
You mean that there may be implementations where EXIT_SUCCESS ==
EXIT_FAILURE? If so how will the environment distinguish between the
two?
lector <hannibal.lecto r99@gmail.comwr ites:
>
I advise against using EXIT_SUCCESS and EXIT_FAILURE as status codes
for functions other than main. It's not absolutely guaranteed that
they have distinct values (though I've never heard of a system where
they don't).
>On Apr 5, 7:37 pm, Willem <wil...@stack.n lwrote:
>>
>One can do that but what if you can't malloc in create function
>because of some error ? For that, it might be necessary to return an
>int (EXIT_SUCCESS/EXIT_FAILURE) for checking.
>>Or you just return the new pointer:
>>>
>>node *create_link_li st(n)
>>>
>>node *create_link_li st(n)
>One can do that but what if you can't malloc in create function
>because of some error ? For that, it might be necessary to return an
>int (EXIT_SUCCESS/EXIT_FAILURE) for checking.
I advise against using EXIT_SUCCESS and EXIT_FAILURE as status codes
for functions other than main. It's not absolutely guaranteed that
they have distinct values (though I've never heard of a system where
they don't).
EXIT_FAILURE? If so how will the environment distinguish between the
two?
Many library functions return zero for success, non-zero for failure;
that's a reasonable convention to follow.
that's a reasonable convention to follow.
Comment