sys/dev: cons.c
sys/kern: init_main.c kern_clock.c kern_cpu.c
sys/sys: heartbeat.h
...
riastradh: heartbeat(9): Move #ifdef HEARTBEAT to sys/heartbeat.h.
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/cons.c.diff?r1=1.94&r2=1.95
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/init_main.c.diff?r1=1.542&r2=1.543
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/kern_clock.c.diff?r1=1.150&r2=1.151
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/kern_cpu.c.diff?r1=1.96&r2=1.97
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/sys/heartbeat.h.diff?r1=1.1&r2=1.2
@JoshJers You can do 95% of this with a header file per API and a bunch of #defines. The last 5% is always tricky of course - you always seem to end up with some #ifdef HLSL sections - honestly that's probably the sweet spot anyway. To "fix" those, you start basically writing your own shader compiler for your own custom language, and that's a lot of work.
sys/arch/amiga/dev: afsc.c
andvar: remove empty #ifdef DEBUG block.
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/amiga/dev/afsc.c.diff?r1=1.46&r2=1.47
sys/dev/pci: if_wm.c
msaitoh: Fix #ifdef WM_DEBUG code in wm_gmii_i82544_{read,write}reg_locked.
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/pci/if_wm.c.diff?r1=1.783&r2=1.784
although, I suppose with careful engine design (and probably a ton of #ifdef's), the same game could use Allegro 4 on DOS and Allegro 5 on modern platforms
@Unixbigot RAM usage is mostly up to you; the framebuffer is always optional. The code size has grown pretty large with the inclusion of e-paper support. I've been thinking about ways of breaking it into optional parts to cut down on the size. I will work on that in the near future so that an #ifdef can be used to disable code that you're not using. Part of the bulk is the inclusion of the Print class from Arduino. It's nice to have, but quite bulky.
I used to start quickie C programs with:
----------------------------
#ifdef notdef
gcc $0 -o $(basename $0 .c)
exit $?
#endif
int main....
---------------------------
Then I could compile by saying "sh foo.c"
This was especially useful if the compile line was complicated (e.g., the C program required linking with special libraries or something).
(Actually I used back-quotes instead of $(....), but this phone doesn't have back-quote on this keyboard.)
@alecui There are some good general software engineering practies to follow!
- Use a build system that supports feature detection, and use it frequently. Minimal use of #ifdef in code. Remember, there's more than just BSD and Linux too. #illumos
- General good portability practices: you would be surprised how much software uses -Werror by default :(
@psychicparrot42 Well it does involve quite some #ifdef BANANA as a matter of isolating/having alternative bits of code .. it also sometime involve to intentionally do something "wrong" to see if the code reacts "properly" to a "wrong" and/or crashes terribly ( via #ifdef BANANA ). It's a method where you start "simplifying to the bone" some complex code re-activating bits going from less to more complex until you understood how all works at least the point you need to make it work ( CONT )
sys/arch/hp300/include: intr.h
riastradh: hp300/intr.h: Put most of this under #ifdef _KERNEL.
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/hp300/include/intr.h.diff?r1=1.35&r2=1.36
I love finding a function in a game that is literally just
void func(const char*){
}
No body. But it's called from 440 different places in the exe.
you can just smell the #IFDEF DEBUGMODE in the binary
Cpythonの_io modulesのfileio.c、`#ifdef MS_WINDOWS`ってあるけど、そもそも_iomodules.cの中で同じ条件で処理分けてるから、そのブロック実行されんくない....?ってなってる。わからん。
sometimes you can just see the shadow of the #IFDEF that wasn't defined.
Every frame, Wheel of Fortune (and Jeopardy) checks to see if PackageAppInterface->bScreenCapRequested is set to true.
and if it is, a function is called, which turns it back off. And does nothing else.