2 ms·
I would agree as well that the code looks great and quite "idiomatic C"; but I'd prefer using 2048 and put the memchr() in the same if with another &&.
by userbinator 9y ago
I would agree as well that the code looks great and quite "idiomatic C"; but I'd prefer using 2048 and put the memchr() in the same if with another &&.
- tonmoy 9y agoI think putting the memchr() in the same if would cause unnecessary calling of the memch() function (and scanning of 2000 bytes) even when any of the other conditions is false! It will work great on a language like ruby, not C.
- userbinator 9y agoC && is short-circuit-evaluated. Something like 'if (y && (k = x/y))' won't crash if y is 0.
- baby 9y agoWhat's the advantage of 2048 over 2000?