Forums
bad habits come back to bite you - Printable Version

+- Forums (http://www.scratchpadgames.net/forums)
+-- Forum: Main Forums (http://www.scratchpadgames.net/forums/forumdisplay.php?fid=1)
+--- Forum: Help my code won't work?? (http://www.scratchpadgames.net/forums/forumdisplay.php?fid=22)
+--- Thread: bad habits come back to bite you (/showthread.php?tid=580)



bad habits come back to bite you - Brian Beuken - 12-06-2020

I have a very bad habit... when defining classes in C++ I often just put the label and type... This is usually ok, since I seldom write release builds.

The reason there's a difference is that in debug builds the compiler usually nulls all variables and clears memory to 0..release builds don't, memory is as it is when it fires up.

Usually.

I discovered the compiler on the Arm64 Jetson doesn't.......

And it took me 6 hours to work out why, in a demo I was workig on that worked perfectly on 8 other machines, only the Jetson redused to display the 1st of 4 test models........


I had not 0'd a rotation Vec3, and in the update of the model I was rotating assuming 0.....


Bad habits only get broken when you make bad mistakes.... 6 hours though...ooooff.. I should know better.

I have now put default values in all class varibles in the class define.


RE: bad habits come back to bite you - jomoengineer - 12-10-2020

Two words, "initializer lists".

Is this the Jetson Nano? Do you know the compiler version used on this vs the others? What version of C++ is the compiler compiling to vs the others?

I would have thought this would give a warning if you do not have class variables initialized when derived.


RE: bad habits come back to bite you - Brian Beuken - 12-10-2020

yeah, but normally with debug builds you don't need to worry, I tend to do the initialiser work when I am likely to do a release....but yes... its a bad habit I will now break it.