Use static_cast instead of C casts