TALLER CEFOP

CEFOP - Mauricio Reyes Schencke

Foros

Responder Responder | Buscar | Ultimo mensaje | Full review

aPEvIGDySJVshbk

 
Septiembre 09, 2021 at 04:21 PM
 
Septiembre 09, 2021 at 04:22 PM

  wrote :

There is a reason why C ausemsd that every function returns int, unless specified otherwise: it's the cheapest way to pass the value to the caller. On practically any implementation, return value is in the register. If the caller doesn't use the return value, it doesn't cost him anything.Now, once you know this, you can see that the most convenient error handling mechanism in C is by using return values.Now "main" is the function that is called by the run time library which is called by the operating system. And RTL and OS have its declaration as int main no matter how you declare main in your text.So int main is expected to signal to the caller if the program execution was succesfull. If you don't return anything, the caller will get the garbage, whatever was in the register at the moment of the return.So you should really get used to this idiom. It's very convenient too. Typically 0 means "everything ok" and other values specific error codes. Take a look at the simplest example: f1 = fopen( if ( !f1 ) return 1; f2 = fopen( if ( !f2 ) { fclose( f1); return 2; } ... return 0;(Off topic: Thanks for a very good blog, I often find interesting stuff here)

 

بلوک سیمانی

 

شماره وکیل

Quote Quote

 
Septiembre 09, 2021 at 09:10 PM

pg  The best and hottest website

Quote Quote

 
Septiembre 09, 2021 at 09:10 PM

slot Good game

Quote Quote

 
Septiembre 09, 2021 at 09:10 PM

pgslot The best and trending website

Quote Quote

Responder


Administrador(es) del curso CEFOP : Mauricio Reyes Schencke
Administrador de Plataforma E-Learnig Claroline :
Impulsado por Claroline © 2001 - 2011