Also, the type should be something like intptr_t.  The value can't really underflow or overflow now because of the size restriction on buffers but if that restriction is ever lifted, the cast becomes undefined in the presence of large buffer objects.