Meadville Space Center
Welcome, Guest. Please login or register.
September 26, 2020, 03:30:00 AM

Login with username, password and session length
Search:     Advanced search
25068 Posts in 2094 Topics by 2266 Members
Latest Member: twa517
* Home Help Search Login Register
+  Meadville Space Center
|-+  Project Apollo - NASSP
| |-+  Project Apollo - NASSP Development
| | |-+  Programming (Moderators: movieman, dseagrav, Swatch, lassombra)
| | | |-+  Casts
« previous next »
Pages: [1] Print
Author Topic: Casts  (Read 1024 times)
movieman
Moderator
Hero Member
****
Posts: 1710



View Profile
« on: January 15, 2008, 01:27:36 PM »

BTW, I've started changing casts in the code from C-style to C++-style when I spot one; it makes them easier to find in a search if you think something might be screwing up, and means you have to think slightly more about what you're doing when you make the cast (e.g. it won't cast from const to non-const unless you use const_cast, whereas C-style casts don't care).

In theory we can also use type-safe casts, but I don't know if they'll work when the code is in multiple DLLs; I think it uses the address of the virtual function table to determine the type.

We should probably start adding 'const' in appropriate places too, when things aren't meant to change.
Logged
lassombra
Moderator
Sr. Member
****
Posts: 410


View Profile Email
« Reply #1 on: January 15, 2008, 01:40:04 PM »

I totally agree.  Though there is also the other side of things, using const when you have to change it.  Caused me more than a few headaches this morning when I couldn't figure out why my code wouldn't compile.  Had thrown in an accidental const in a method definition.
Logged

My current Project Apollo work:

Quickstart to the Moon initiative (Quickstart_to_the_Moon): Done through earth orbit.  Working on new method of calculating TLI.

Checklist Controller: 
  • MFD Interface 99%(Minor cleanup and future features remain)
  • Panel Interface 99%
  • Excel interface and logic 99%
  • LEM Event code.0%
  • DSKY Interface code. Framework complete, creating "buttons"
  Approximately 80% done. (Checklist Controller
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.10 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!