|
|
|
|
|
by gosu
5002 days ago
|
|
I use #define to do things that plain C just can't do, and I wind up wanting to do these things pretty often. Two of the most important strengths of macro functions, for me, are VA_ARGS and the related ability to write a macro that counts the number of arguments which it has been passed. Oh, and using container_of() to write generic data structures. Given that Kernigham and Ritchie were using C to write an OS, it's not surprising that they'd be wary of dynamic allocations. |
|