Content deleted Content added
EdC~enwiki (talk | contribs) →Examples: POSIX |
EdC~enwiki (talk | contribs) m →Examples: fmt |
||
Line 3:
==Examples==
In programming languages without [[structured exception handling]] (e.g. in the [[C programming language]]), ''error codes'' are often stored in [[global variable]]s with names like
/* attempt to open file for reading */
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 <
==Error codes and exception handling==
|