Error code: Difference between revisions

Content deleted Content added
Examples: added link to structured exception handling
Examples: POSIX
Line 11:
printf("Cannot open file, error %i, %s\n", errno, strerror(errno));
 
Since error codes are typically global variables, they can be read or written from any portion of the program. As with other global variables, that ease of access can be a source of problems in a [[thread (computer science)|multithreaded]] environment, since the process global variables could be set by more than one thread, causing a [[race condition]]. To fix this problem, [[POSIX]] defines <tt>errno</tt> to be a [[thread-local]] variable.
 
==Error codes and exception handling==