[gnutls-devel] Regression in gnutls-3.2.2: server accepts clients without a certificate

Petr Pisar petr.pisar at atlas.cz
Thu Aug 29 22:19:26 CEST 2013


On Thu, Aug 29, 2013 at 10:15:25PM +0300, Nikos Mavrogiannopoulos wrote:
> On Thu, Aug 29, 2013 at 4:54 PM, Petr Pisar <petr.pisar at atlas.cz> wrote:
> >
> > BTW, ISO C 99 recognizes `_Bool' type which you could use instead of the
> > 1-bit-long integer bit-fields.
> >
> 
> Would that provide any advantage over unsigned int:1? We use the latter
> quite some time now with no reported issues.
> 
Not sure. It matches semantically better.

And you get correct coercion too. With

    _Bool value = 2;

the value becomes 1, i.e. true, while

    unsigned int bit:1 = 2;

stores 0, i.e. false, because of wrapping.

Of course problem is storage size. _Bool usually occupies one word due to
performance reasons. You would still have to write

struct {
    _Bool value:1;
    ...
}

to get packed bit-field to spare memory.

On the other hand, integer bit-field allows to preserve API by enlarging the
size if it turns out that the value should be able to represent more than
two different states.

-- Petr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 230 bytes
Desc: not available
URL: </pipermail/attachments/20130829/0a02f2e9/attachment.sig>


More information about the Gnutls-devel mailing list