httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yann Ylavic <ylavic....@gmail.com>
Subject Re: svn commit: r1603863 - in /httpd/httpd/trunk/modules: aaa/mod_auth_basic.c http/http_filters.c
Date Thu, 19 Jun 2014 13:29:40 GMT
On Thu, Jun 19, 2014 at 2:59 PM, Jim Jagielski <jim@jagunet.com> wrote:
>
> On Jun 19, 2014, at 8:43 AM, ylavic@apache.org wrote:
>
>> Author: ylavic
>> Date: Thu Jun 19 12:43:05 2014
>> New Revision: 1603863
>>
>> URL: http://svn.apache.org/r1603863
>> Log:
>> Use unsigned bit flags (otherwise the non-zero value to be used is -1).
>>
>
> I don't understand that at all... A bit is either 1 or 0.
>

Well, it depends on what you are doing with that bit...

#include <stdio.h>
int main(int argc, const char *argv[])
{
    struct {
        int s:1;
    } bitfield;

    bitfield.s = 1;
    if (bitfield.s > 0) {
        printf("positive\n");
    }
    else {
        printf("negative or nul\n");
    }
    if (bitfield.s == 1) {
        printf("one\n");
    }
    else {
        printf("not one\n");
    }

    return 0;
}

$ ./bitfield
negative or nul
not one

Mime
View raw message