lundi 23 novembre 2015

Can adding extra const qualifications break functionality (assuming compilation went fine) ?

As I try to apply const-correctness for my own code, I often have to add const qualifications to function definitions in other modules (written by other programmers) in order to use those functions in my own code. (see here on back-patching const-correctness)

I always thought that if everything compiles fine, this could impossibly lead to broken functionality as const labels only matter at compile time.

Yet, the other day one of my colleagues insisted that I should rerun all automated tests before I commit code with added const labels, where I thought it was sufficient that such code compiled.

Does he have a point? Is there a way that applying const-correctness could break existing functionality ?

Aucun commentaire:

Enregistrer un commentaire