On Fri, Dec 22, 2006 at 01:58:39AM +0100, Denis Vlasenko wrote: > > Or this, absolutely typical C code. i386 arch can compare > 16 bits at a time here (luckily, no alighment worries on this arch): > > # cat tt.c > int f(char *p) > { > if (p[0] == 1 && p[1] == 2) return 1; > return 0; > }
No, because you'd read past the end of the array: #include <stdlib.h> int main (int argc, char *argv[]) { char *a; if ((a == malloc (sizeof (char)))) { int r; a[0] = 1; r = f (a); free (a); return (r); } return (0); } -- Rask Ingemann Lambertsen