Don't do this. It leads to all kinds of problems for 64-bit architectures,
I'm not at all sure that casting (int) -1 to a pointer is at all safe. I
would not be surprised if it is entirely legal and expected on some
architectures for it to become 0x00000000ffffffff, which might be a
perfectly valid pointer.
If you play error games with pointers, there's just two ways to do it
nicely: either the NULL pointer (right now) or by having a nicely
abstracted thing that can be extended to do different things on different
architectures (this is what the "dcache" error pointers are doing with the
ERR_PTR/PTR_ERR/IS_ERR stuff - right now all architectures have pointers
that look roughly the same and there is just one global definition for
ERR_PTR, but if some strange architecture comes along some day we'll be
able to handle it cleanly).
In the meantime, things like this are _definitely_ a bad idea.
Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/