February 22, 2002

Boolean Conversion

Numeric values and pointers are implicitly converted to a Boolean value in conditional expressions. For example: void *p = get_ptr();if(p){ // process p} A zero value evaluates as false. All

Using Pointers as Integers

In the early days of C, pointers were plain integers. Relics of this approach can still be found in vintage APIs and legacy code. For instance, the ANSI C header

Notes about the system() Function

The system() function (declared in ) launches another program from the current program. As opposed to what most users think, it doesn’t return the exit code of the launched process.

A Recommended Exception Handling Policy

Exceptions report abnormal runtime situations. Although you have other mechanisms for detecting and reporting runtime errors, exceptions are advantageous because they automate the process of passing the error from a

Uses of the

The volatile specifier disables various optimizations that a compiler might automatically apply and thus introduce bugs. I