How to properly use macros in C

Macros in C
One strange phenomenon when coding in C is using macros. This is not something which can be seen in modern programming languages (other than C++). And that is for a reason. Using macros can be extremely unsafe and they hide a lot of pitfalls which are very hard to find. However, as a C or C++ programmer, inevitably, you will encounter macros in your coding life. Even if you don't use them in your own project, there is a high chance you will encounter them somewhere else, such as a library. Your duty is to understand why using this programming feature is dangerous and what dangers it holds. If you don't, then you can run into some pretty nasty errors which are hard to debug and discover.
Continue Reading

Site Footer