View Single Post
Old 23 November 2020, 21:34   #9
thomas
Registered User
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 6,218
Quote:
Originally Posted by Ernst Blofeld View Post
Not sure how this compiles, but

Code:
    Model * wibble = (Model *) wibble;
also compiles, and wibble definitely doesn't exist anywhere else in my code.
Why do you say it does not exist? You make it exist kust by that line.

The line is just a short form of

Code:
Model *wibble;
wibble = (Model *)wibble;

What you really should do is to avoid all that casting. Use proper types for your variables.

For example in your first post instead of

ModelData *m = (ModelData *) b;

you should use

ModelData *m = &b->modelData;

This way the compiller can help you. If you use casting you tell the compiler that you know better than him. But obviously you don't.
thomas is online now  
 
Page generated in 0.08153 seconds with 11 queries