3 ms·
Header files are generally declarations, not executable code, and for a program that's 50 lines long, it probably doesn't even have room to use all 4000 lines o
by geofft 8y ago
Header files are generally declarations, not executable code, and for a program that's 50 lines long, it probably doesn't even have room to use all 4000 lines of declarations. It looks like it uses three structs and about three members of each of those structs, a half-dozen function calls, and a handful of constants, so you could write it without the include in under 100 lines.
A more meaningful objection is that you link with -lX11, which is a significant amount of actual code. But apart from "what about libc and the kernel" counterarguments, the X protocol is actually pretty straightforward - I'd bet you could write this with just socket syscalls in about as many lines of code, too. (Which is to say, an embedded system without libX11 could implement a window manager for a remote machine given just ~100 lines of C or similar and a TCP stack, and the TCP stack is only required because it's remote, anyway.)