Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Using return, return0. anort and exit

Status
Not open for further replies.

lcs81

Member level 3
Member level 3
Joined
Aug 2, 2005
Messages
57
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,683
How to know when to use the statement "return"?

What the diffrent between return & return0?

Any one know how to use abort and exit?

[/i]
 

return0? anort? Which language is that?
 

Re: Using return, return0. abort and exit

C language
 

The C language doesn't have anything called "return0" and "anort".

A "return" statement terminates execution of the current function and returns control to its caller.

Here are descriptions of "abort" and "exit" from the C standard:

7.20.4.1 The abort function

Synopsis

#include <stdlib.h>
void abort(void);

Description

The abort function causes abnormal program termination to occur, unless the signal SIGABRT is being caught and the signal handler does not return. Whether open streams with unwritten buffered data are flushed, open streams are closed, or temporary files are removed is implementation-defined. An implementation-defined form of the status unsuccessful termination is returned to the host environment by means of the function call raise(SIGABRT).

Returns

The abort function does not return to its caller.

7.20.4.3 The exit function

Synopsis

#include <stdlib.h>
void exit(int status);

Description

The exit function causes normal program termination to occur. If more than one call to the exit function is executed by a program, the behavior is undefined.

First, all functions registered by the atexit function are called, in the reverse order of their registration) except that a function is called after any previously registered functions that had already been called at the time it was registered. If, during the call to any such function, a call to the longjmp function is made that would terminate the call to the registered function, the behavior is undefined.

Next, all open streams with unwritten buffered data are flushed, all open streams are closed, and all files created by the tmpfile function are removed.

Finally, control is returned to the host environment. If the value of status is zero or EXIT_SUCCESS, an implementation-defined form of the status successful termination is returned. If the value of status is EXIT_FAILURE, an implementation-defined form of the status unsuccessful termination is returned. Otherwise the status returned is implementation-defined.

Returns

The exit function cannot return to its caller.
For tutorials and examples, grab your nearest good C book.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top