18 ms·
This kind of thing shows why ifdefs are usually the wrong tool for multi-target projects. There should be a platform adapter API instead that defines a shared
by pavlov 5y ago
This kind of thing shows why ifdefs are usually the wrong tool for multi-target projects.
There should be a platform adapter API instead that defines a shared header with function names for these actions, multiple platform-specific implementation files, and only one of them gets compiled.
That way you could simply ignore the existence of "filesys_amiga.c", and then maybe delete it 50 years from now.
(I realize it's probably not realistic to do such major internal surgery on Make at this point.)
- dhosek 5y agoThis was one of the brilliant aspect of Knuth's web system: You could have change files that would be applied to the immutable source to manage ports to individual platforms.¹ I really wish that this sort of patching had spread to other programming paradigms. ⸻ 1. It works even on somewhat actively developed code since the likely to require porting parts of the program could be clumped together in a web source file and, once isolated, generally saw few if any changes. I remember maintaining the public domain vms change files for the TeX 2–3/MF 1–2 upgrades and as I recall, even with these significant changes to the programs, no updates for the change files were necessary.² 2. Most of the work that I did back then in maintenance was centered around enhancements to the VMS-specific features. For example, rather than having iniTeX be a special executable, instead, iniTeX features could be enabled/disabled at runtime from a single executable.³ Similarly with debug code. 3. This feature appeared soon after in the web2c port of TeX and friends, but I think that Tom Rokicki might have got the idea from me (or else it was a case of great minds thinking alike in the late 80s).
- rbanffy 5y ago> This was one of the brilliant aspect of Knuth's web system As they say, those who don't know the past, are bound to repeat it.
- brooksbp 5y agoI respectfully disagree to this very common argument against ifdefs, and will also point out that developers who hold this anti-ifdef belief hold it quite strongly! I generally prefer the ifdef-style.