C

Preprocessor – the #undef Directive

Behaviour of the #undef directive is the same in both C and C++. Purpose It is used to undefine a macro. A macro is an identifier (or label) followed by replacement text. There is only a single namespace for macros. A program which redefines an existing macro is considered to be malformed – even though […]

C

Preprocessor – The #define Directive

This is the most complicated of the preprocessor directives (a little over 7 pages is devoted to it in the C99 spec and the C++98 spec devotes about 4 pages to it). Behaviour of the #define directive is the same in both C and C++. C99 added variable argument macros; the upcoming C++0x standard adds […]

C

Preprocessor – The Token Pasting (##) Operator

This is probably the least understood and most poorly documented preprocessor operator. The token pasting (##) operator simply eliminates any white space around it and concatenates (joins together) the non-whitespace characters together. It can only be used in a macro definition. It is used to create new tokens. It may not be the first or […]

Mathematics

Understanding Pi

Pi is the ratio of the circumference of a circle to its diameter. It is a constant. The familiar value is 3.14159. It is irrational – it cannot be written as a fraction using 2 integers, although, some approximations, like 22 / 7, are used. It is transcendental – this means there is no algebraic […]