On Thu, Jun 15, 2017 at 08:38:16AM +0200, Martin Mares wrote:
Hello, world!\n
for (tlv = (void *) hdr + state->current_tlv_endpos; - tlv < hdr + TLV_LENGTH(hdr); + (void *) tlv < (void *) hdr + TLV_LENGTH(hdr); tlv = NEXT_TLV(tlv))
BTW, is there any reason for doing that pointer arithmetics on void pointers instead of char pointers? It looks like an unnecessary GCCism.
Hi Well, it is not only here but already on plenty of other places in BIRD code. I don't have a strong opinion about pointer arithmetics on void pointers. I generally avoid it when writing code but otherwise keep it. It is true that it is GCCism that is simply eliminable, but it is also supported by Clang and possibly others as it is a natural extension. In this particular case it does not help, but in other cases it avoids some uninformative double casts. Now, when i am looking at this particular case, i realized it could be replaced by simple: tlv < NEXT_TLV(hdr); -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."