jeudi 17 décembre 2020

How to find out what a cstyle cast actually does?

I'm working with a codebase that is quite old and has a lot of c-style casts.

I know what a c-style cast can do but how do I quickly find out what a line of code like this does:

WhateverClass* oldD = (WhateverClass*)d->GetHandle();

I know I can go through the code, find out what GetHandle() returns, determine how is it related to WhateverClass and then reason about which of the five possible outcomes of c-style cast applies here.

Still I am a human prone to errors and I'd much prefer a definitive answer free of my reasoning.

I'm using Visual Studio 2017 but I'm also interested to hear about other IDEs and compilers.

Aucun commentaire:

Enregistrer un commentaire