[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: rev 2586 - trunk trunk/subversion/libsvn_subr

From: Branko Čibej <brane_at_xbc.nu>
Date: 2002-07-20 00:43:26 CEST

Karl Fogel wrote:

>>>APR_EINVAL. The APR_STATUS_IS_EINVAL macro only tests for the latter,
>>>I thought.
>>Yeah, right. And APR_EINVAL is defined to be EINVAL. apr_errno.h is your friend.
>>May the source be with you!
>But APR_STATUS_IS_EINVAL() can test for more than just APR_EINVAL...
>?? _sigh_
>I fscking *hate* those STATUS_IS macros. They obfuscate everything,
>because their definitions are non-trivial, but then everyone insists
>they're "just like" doing a simple equality test.

Who's that "everyone"? Everyone insists that APR_STATUS_IS_SUCCESS(foo)
is nonsense, because that is _guaranteed_ to be the same as (foo ==
APR_SUCCESS), which is also guaranteed to be (!foo).

The same everyone insists that the macros should always be used for
checking everything except success.

> If they were, we
>wouldn't have the macros. If they're not, then you can't use them as
>a simple equality test.
>Perhaps there's a good explanation for all this, and I just haven't
>been enlightened yet.
Mu! :-)

It's extremely simple.

    * Every APR_STATUS_IS_E* macro tests at least the equivalent APR_E*
    * Where the POSIX/ISO C E* code exists, APR_E* is defined in terms
      of it.
    * There Be Platforms where there can be more than one system error
      code that's semantically equivalent to one of the APR_E* codes
      (and those are descended from POSIX/ISO C E* codes). On those
      platforms, the APR_STATUS_IS_* macros must test more than one value.

The purpose of those macros is to hide platform differences. Which,
incidentally, is the purpose of APR. That's why you should always use
those macros instead of direct comparison, _except_ for APR_SUCCESS,
where it doesn't matter because it's guaranteed to be 0 on all platforms.

Are you enlightened yet? :-)

Brane Čibej   <brane_at_xbc.nu>   http://www.xbc.nu/brane/
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Jul 20 00:43:55 2002

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.