[commit: packages/unix] master: Fix assumption that RLIM_INFINITY is a simple number (b092e35)

Herbert Valerio Riedel hvr at gnu.org
Mon Oct 14 06:15:52 UTC 2013

On 2013-10-14 at 06:07:01 +0200, Bryan O'Sullivan wrote:


> You'll want to take a look at what hsc2hs actually does here to really
> understand :-)
> In short, a constant C-level expression is fine if used in a #const
> construct, regardless of it containing embedded casts and whatnot.

thx, now I see! :-)

Otoh, does that mean one could have rewritten that to something like

  ##if defined(RLIM_SAVED_MAX) && (#{const RLIM_SAVED_MAX} != #{const RLIM_INFINITY})
  unpackRLimit (#const RLIM_SAVED_MAX) = ResourceLimitUnknown

instead and exploit the fact that CPP can be run a second time when
compiling the resulting .hs file, which would then take care of the
#ifdef with the '#const' terms already evaluated?


More information about the ghc-devs mailing list