Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
bad habits come back to bite you
#1
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.
Brian Beuken
Lecturer in Game Programming at Breda University of Applied Sciences.
Author of The Fundamentals of C/C++ Game Programming: Using Target-based Development on SBC's 



Reply
#2
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.
Reply
#3
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.
Brian Beuken
Lecturer in Game Programming at Breda University of Applied Sciences.
Author of The Fundamentals of C/C++ Game Programming: Using Target-based Development on SBC's 



Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)