I'm pondering a bit about the code I'm seeing in nginx...
It's a code for checking if a string equals a sequence of characters:
The code is calling this macro, such that:Code:#define ngx_str3_cmp(m, c0, c1, c2, c3) \ *(uint32_t *) m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)
- m is a u_char*
-c0,c1,c2,c3 are chars
so, to me it seems the code is casting u_char* to uint32_t*, and de-referencing it..? Is this legal C99, with respect to strict aliasing and such? I thought it wouldnt be legal, but my compiler doesen't compain