Nikos Mavrogiannopoulos nmav@gnutls.org writes:
My concern is on the easiness to have a bug-free transition to 3.0 from 2.7.1.
I see. I don't think I'm going to remove the cast for nettle-3.1. I view it as a feature, not a bug. The intent is to reduce the amount of casts in application code, and provide something slightly safer.
I wonder if there are any other simple changes (besides documenting potential problems) which would reduce upgrade problems?
Hmm, maybe, in the
(0 ? (encrypt)(&(ctx)->cipher, 0, (void *)0, (void *)0)
part of macro, intended for typechecking, one could change the 0 constant for the size argument to some larger constant which doesn't fit in a plain int. E.g., consider the following test program:
#include <stdlib.h>
extern foo (int x);
int main (int argc, char **argv) { if (0) foo (~(size_t)0); return 0; }
When I compile it with gcc, version 4.7.2, no optimization or special warning flags, on x86_64, it produces a warning,
size_t-type-checking.c: In function `main': size_t-type-checking.c:8:5: warning: overflow in implicit constant conversion [-Woverflow]
Regards, /Niels