The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [TUHS] Mac OS X is Unix
@ 2017-01-03 20:19 Doug McIlroy
  2017-01-03 21:05 ` Charles Anthony
                   ` (4 more replies)
  0 siblings, 5 replies; 20+ messages in thread
From: Doug McIlroy @ 2017-01-03 20:19 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1213 bytes --]

> keeping the code I work on portable between Linux and the Mac requires
> more than a bit of ‘ifdef’ hell.

Curmudgeonly comment: I bristle at the coupling of "ifdef" and "portable".
Ifdefs that adjust code for different systems are prima facie
evidence of NON-portability. I'll buy "configurable" as a descriptor
for such ifdef'ed code, but not "portable".

And, while I am venting about ifdef:
As a matter of sytle, ifdefs are global constructs. Yet they often
have local effects like an if statement. Why do we almost always write

#ifdef LINUX
	linux code
#else
	default unix code
#endif

instead of the much cleaner

	if(LINUX)
		linux code
	else
		default unix code

In early days the latter would have cluttered precious memory
with unfreachable code, but now we have optimizing compilers
that will excise the useless branch just as effectively as cpp.

Much as the trait of overeating has been ascribed to our
hunter ancestors' need to eat fully when nature provided,
so overuse of ifdef echos coding practices tuned to
the capabilities of bygone computing systems.

"Ifdef hell" is a fitting image for what has to be one of
Unix's least felicitous contributions to computing. Down
with ifdef!
Doug


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2017-01-04 17:14 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-03 20:19 [TUHS] Mac OS X is Unix Doug McIlroy
2017-01-03 21:05 ` Charles Anthony
2017-01-03 21:33   ` [TUHS] When was #if introduced in C? (was: Re: Mac OS X is Unix) Michael Kjörling
2017-01-03 21:53     ` Robert Swierczek
2017-01-03 21:57       ` Clem Cole
2017-01-03 21:56     ` Clem Cole
2017-01-03 21:35 ` [TUHS] Mac OS X is Unix Clem Cole
2017-01-03 22:10   ` Lyndon Nerenberg
2017-01-03 21:39 ` Lyndon Nerenberg
2017-01-03 22:12   ` ron minnich
2017-01-03 23:39     ` Tim Bradshaw
2017-01-04  0:12       ` ron minnich
2017-01-04  9:11         ` Tim Bradshaw
2017-01-04 10:04           ` Álvaro Jurado
2017-01-04  0:13 ` Steve Johnson
2017-01-04  3:50 ` Dan Cross
2017-01-04 12:26   ` Tim Bradshaw
2017-01-04 13:49     ` Random832
2017-01-04 15:02     ` Dan Cross
2017-01-04 17:14       ` tfb

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).