News for hackers. Stuff that matters.
Re:Rewrite Everything in Rust by 0xcde4c3db on Monday February 22, 2016 @10:47PM (#11156366)
I've seen a lot of weird preprocessor (ab)use in GNU code. The coreutils true/false (of all programs to invoke clever preprocessor tricks...) has this gem:

in true.c (all told, an 80-line file):

  /* Act like "true" by default; false.c overrides this.  */
  #ifndef EXIT_STATUS
  # define EXIT_STATUS EXIT_SUCCESS
  #endif
false.c, of course, contains only:

  #define EXIT_STATUS EXIT_FAILURE
  #include "true.c"
On my current system, each of these represents a stately 27KB dynamically linked executable.

By way of comparison, the OpenBSD version of true comprises nine lines with zero preprocessor directives:

  /*	$OpenBSD: true.c,v 1.1 2015/11/11 19:05:28 deraadt Exp $	*/

  /* Public domain - Theo de Raadt */

  int
  main(int argc, char *argv[])
  {
  	return (0);
  }
Re:Rewrite Everything in Rust by masklinn on Tuesday February 23, 2016 @02:48AM (#11157255)
But BSD true doesn't support --version, how are you going to check your version of true without a locale-aware version string (and yes, gnu true is locale-aware, and contains 2k of strings including 48 encoding names and 36 format strings — 10 of which are duplicates, and for some reason refers to the SHA2 utilities)

(I dimly remember an essay about similar issue in a similar mainframe command (maybe in JCL?) taking a bunch of revisions to actually get right?)

Re:Rewrite Everything in Rust by CyberDildonics on Monday February 22, 2016 @10:58PM (#11156416)
If I write something and make it simple, how will people know what a jenius I am?