You are hereArticles, Programming

Articles, Programming


The Pitfalls of Using Default Function Parameters in C++

C++ (not C, nor C#) has a convenience feature that allows programmers to specify default parameters on functions when declaring them. The compiler uses the default value if no value is supplied by the caller for that parameter, instead of complaining about a missing parameter value. I am not going to discuss the mechanics of declaring these default parameters; any C++ book will explain this. I’m going to delve into what problems happen overtime when using default parameters during software maintenance phase as code ages and changes hands between programmers.

Using the C++ #define Directive

The #define directive in C++ is usually glossed over in most books that attempt to teach the C++ language. It obviously takes much lower precedence than more important language constructs like if and switch. However this directive deserves far more credit than it gets. Here are some of the feats this directive can perform.

Programmers and Pointers

It seems that when it comes to programming computers there is no escaping the mention of the word pointers. Recent programming language trend is to automatically handle pointers, hiding gory details from the programmer. While this might be a good language feature, will it eventually result in a new generation of programmers who do not understand pointers?