4 ms·
> That should be in a .h file somewhere. Remember, don't put #ifdef in .c files please. Why?
by jancsika 5y ago
> That should be in a .h file somewhere. Remember, don't put #ifdef in .c
files please.
Why?
- coldpie 5y agoRead the replies :) https://lkml.org/lkml/2021/12/6/1683 https://lkml.org/lkml/2021/12/6/1683
- vlovich123 5y agoThat's a confusing conversation that I still don't understand. 1. "Don't put ifdef" 2. "Why?" 3. "Put this other ifdef"???
- coldpie 5y agoIt keeps the code flow, which lives in the C file, easier to read. You can assume the function does the appropriate thing for the given configure situation without having to keep track of all the compile-time conditionals as you scan the implementation.
- jensarv 5y agoYeah the other ifdef goes in the header file
- jfindley 5y agoThey aren't saying "don't use ifdef", they're saying "put the ifdef in the header instead, because it makes the implementation easier to read"