httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikhail T." <mi+t...@aldan.algebra.com>
Subject Re: Proposal: error codes
Date Mon, 28 Nov 2011 17:09:14 GMT
On 27.11.2011 12:14, Stefan Fritsch wrote:
> Yes, that would be a good idea and I agree with Daniel that we should
> use a distinct prefix or format. We currently have around 2700 calls
> to *_log_?error in trunk, so a 4-digit number should be ok. Together
> with for example AH as prefix for "Apache HTTPD" this would result in
> numbers like AH0815 which don't seem to cause many hits on google.
I'd like to suggest, the codes be 8-character (or shorter) words and declared as 
something like:

    union apr_error_code {
         uint64_t    i;
         char    s[8];
    };

This way the code itself can contain a meaningful short-string (printable and 
human-readable):
but different codes can still be assigned and compared without a special function:

    if (code.i) {
         log("Attempt to foo returned: %.8s", code.s);
    }

The actual numbers may differ between platforms of different endianness, but who 
cares -- as long as the character strings themselves remain the same and 
meaningful... Yours,

    -mi


Mime
View raw message