I don't think that casting a range of bits as some other arbitrary type "is a bug nobody sees coming".

C++ compilers also warn you that this is likely an issue and will fail to compile if configured to do so. But it will let you do it if you really want to.

That's why I love C++

a screenshot from linkedin reading "I don't think that casting a range of bits as some other arbitrary type "is a bug nobody sees coming". C++ compilers also warn you that this is likely an issue and will fail to compile if configured to do so. But it will *let you do it* if you really want to. That's why I love C++"
you are viewing a single comment's thread
view the rest of the comments
[–] 4 points 1 year ago* (3 children)

Depends on the age of the codebase, the age of the compiler and the culture of the team.

I’ve arrived into a team with 1000+ warnings, no const correctness (code had been ported from a C codebase) and nothing but C style casts. Within 6 months, we had it all cleaned up but my least favourite memory from that time was “I’ll just make this const correct; ah, right, and then this; and now I have to do this” etc etc. A right pain.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 3 points 1 year ago (2 children)

    So, did you get it down to 0 warnings and manage to keep it there? Or did it eventually start creeping up again?

  • source
  • parent
  • hideshow 2 child comments