W3C home > Mailing lists > Public > ietf-http-wg@w3.org > April to June 2014

Confusing numbering of flags & bits

From: Willy Tarreau <w@1wt.eu>
Date: Sat, 28 Jun 2014 10:52:43 +0200
To: HTTP Working Group <ietf-http-wg@w3.org>
Message-ID: <20140628085243.GF13299@1wt.eu>
Hi,

I'm currently looking at the spec in more details. I find it extremely
confusing that bit numbers for flags are shifted by one, for example :

   ACK (0x1):  Bit 1 being set indicates that this frame acknowledges...

Here I'm obviously tempted to define :

    #define ACK  BIT(1)

with a classical BIT(n)=(1<<(n)). But that's wrong since in fact it's
not bit 1 but bit 0. On some frames which define many flags, it's
easier to guess what's wrong, but on frames which define a single flag,
the mistake is very easy. I don't see any valid reason for numbering
bits in this very unusual way, so I'd suggest we fix this before the
release.

Regards,
Willy
Received on Saturday, 28 June 2014 08:53:07 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:31 UTC