3 ms·
I think it's wrong to call it poorly written because the programmer only accounted their C preprocessor code for ~99.99% of desktop and mobile operating systems
by ianremsen 11y ago
I think it's wrong to call it poorly written because the programmer only accounted their C preprocessor code for ~99.99% of desktop and mobile operating systems. The diminishing return for avoiding this approach is so impalpable it hurts.
Windows, OSX/iOS/BSD, and Linux/Android literally are everything anyone ever uses, within rounding error.
- ori_b 11y agoThe diminishing return approach is this: #ifdef LINUX // include Linux headers #elif defined(BSD) // include BSD headers #elif defined(WINDOWS) // include Windows headers. # else #error "unsupported system" #endif
- viraptor 11y agoIf you develop for different platforms then it may actually make sense to do a "if linux / elif bsd / elif windows / else #error unsupported". At least it gives you a proper answer in case you forgot you have some wild crosscompiler in your path. But I understand it's not a popular concern...