3 ms·
You can do something similar to what golang does. You can define an interface and then have a `thing_x86.c` and a `thing_arm64.c` etc. If you abstract the probl
by gravypod 5y ago
You can do something similar to what golang does. You can define an interface and then have a `thing_x86.c` and a `thing_arm64.c` etc. If you abstract the problem this way you are very explicit about what is being linked into the binary while not having the complex state management issues of preprocessor magic.
- rurban 5y agoEmbedded uses such HAL's extensively. There is no such nested ifdef mess mid-level devs love to create. Linux KConfig system is also properly designed, leading to properly seperated features. Never mix compile-time logic with runtime logic, you get lost. No need for a study to verify this. #ifdef is not considered harmful, only stupid usage of it.