Replacing old C-style casts with static|reinterpret_cast?



Murray mentioned on a Bugzilla that replacing these with static_cast<> is always good.

Is the same true for cases where we need reinterpret_cast<> ? That is semi frequent because GTK+ types are opaque even to us, so converting pointers cannot use static_cast<> as the latter cannot verify that e.g. both types have the same 1st member.

The raw C cast would ultimately boil down to a reinterpret_cast anyway, so my POV is that we should explicitly write the latter, as it signals that we know what we're doing - rather than the raw cast, which only really says 'try everything you can think of, and pick anything that barely works'!

Cheers,
Daniel



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]