tech-userlevel archive

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

Re: [PATCH 1/6] fix ambiguous errno treating after mktime()

    Date:        Mon, 1 Sep 2008 07:10:45 +0000
    From:        David Holland <>
    Message-ID:  <>

  | What same code? We're talking about the library code, not some random
  | application.

No, we're talking about why you'd want to do that in the library.

The only point could possibly be for callers of the library function,
if not for them, the library function wouldn't exist at all.   If
is that code that cannot correctly test errno, hence, what the library
function does with errno cannot possibly be relevant.

  | I don't see how this pertains to NetBSD library code. But even so,
  | regardless of what some standard may say, a lot of existing
  | application code assigns errno and will fail to compile on such
  | systems, earning them the classification "broken".

Yes, I know, it used to be very common.  But the standards changed
(or perhaps, more accurately, were created).   And now it is wrong.

But you're right, NetBSD's libc can know about the NetBSD implementation
and use what would otherwise be undefined behaviour.  I'm not sure mktime()
is the best function to make that argument, as it is pretty much shared
amongst several implementations, but knowing errno is an lvalue in libc
isn't erroneous.

What it is, is pointless, as nothing calling mktime() can depend upon it.
So you're having (proposing having) the library function do extra work
that benefits no-one - rather just hides application bugs.


Home | Main Index | Thread Index | Old Index