News for hackers. Stuff that matters.
Re:How to Write Portable C Without Complicating Your Build by logicchains on Friday March 31, 2017 @08:30AM (#14003008)
That's quite similar to how Go does it (Go would have something like hello_platform.c), which in my opinion works quite well. I actually find it to be one of the nicest things about Go, compared even to Haskell, which for some bizarre reason uses the C preprocessor (!!) to pepper code with #ifdefs.
Re:How to Write Portable C Without Complicating Your Build by ycmbntrthrwaway on Friday March 31, 2017 @09:00AM (#14003226)
Go took this idea from Plan 9. In fact, Go shares a lot with Plan 9 C compiler structure.

Related: http://doc.cat-v.org/henry_spencer/ifdef_considered_harmful

Re:How to Write Portable C Without Complicating Your Build by marcosdumay on Friday March 31, 2017 @01:13PM (#14005865)
> for some bizarre reason uses the C preprocessor (!!) to pepper code with #ifdefs.

I always thought that was funny. You are using the most powerful (of the widely used) language available for transforming text, but must fall back to the C preprocessor.

Re:How to Write Portable C Without Complicating Your Build by Keyframe on Friday March 31, 2017 @10:36AM (#14004189)
Interesting! I never went in-depth into Go, apart from spending an afternoon with it to have a go at it.