Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/lib/libc/stdio



    Date:        Sat, 23 Oct 2010 16:33:37 +0100
    From:        Matthias Scheler <tron%NetBSD.org@localhost>
    Message-ID:  <20101023153336.GA822%colwyn.zhadum.org.uk@localhost>

  | I'm sorry but this whole code is horrible.

I agree with that, but ...

  | What is wrong with something as simple as this?

  | +#define _FPOS_OVERFLOW(pos) ((pos) < LONG_MIN || (pos) > LONG_MAX)

That evaluates its arg 0, 1 or 2 times  -- 0 if you're right and the wole
thing is sometimes optimised away, 1 if the value is < LONG_MIN, and twice
(most commonly) otherwise.

Macros that act like that without a very good reason are pure evil.

kre



Home | Main Index | Thread Index | Old Index