[so] [Good Practice][Void Function][exit]
Codrut Grosu
codrut.cristian.grosu at gmail.com
Fri Apr 1 01:16:56 EEST 2016
Salut!
Este in regula daca intr-o functie care nu intoarce nimic(void) sa avem
exit(EXIT_FAILURE) in cazul tratarii unei erori ?
Exemplu :
void codrut(void)
{
/* Mult cod */
int fd = dup(STDOUT_FILENO);
if (fd < 0){
perror("Nasol");
exit(EXIT_FAILURE);
}
/* Restul codului. */
}
Mersi,
Codrut.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cursuri.cs.pub.ro/pipermail/so/attachments/20160401/577afbc9/attachment.html>
More information about the so
mailing list