|
|
|
|
|
by jjnoakes
1778 days ago
|
|
They can be made to work by introducing stubs for every os/arch/compiler/dependency I support, but that's way more work for dubious gain. And who is to say I'm doing it wrong? Just because conditional compilation CAN lead to a rat nest doesn't mean it MUST. And if it happens to be well-organized and works as is, there is no problem. |
|
Oh, have I heard that before. Here's what happens, over the years, to such code:
1. #ifdef's on the wrong feature. For example, #ifdef on operating system for a CPU feature.
2. Overly complex #if expressions, that steadily get worse.
3. Fixing support for X that subtlety breaks F and Q support. It goes unnoticed because your build/test machines are not F and Q.
4. People having no idea what #defines to set on the command line, nor what the ones that are set are doing (if anything).
4. People having no idea how to fold in support for new configurations.
5. Code will #ifdef on predefined macros that have little or no documentation on what they're for or under exactly what circumstances they are set. If the writer even bothered to research that. gcc predefines what, 400 macros?
> Just because conditional compilation CAN lead to a rat nest doesn't mean it MUST.
Jyust yew wite, 'enry 'iggins, jyust yew wite!