Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

const const after the function name

I am investigating a block of code (that I did not write) that looks like:

customType foo::bar(void) const const {
    // baz
}

As far as I understand, the const const should really just be const. I can’t find any reference to a valid usage of const that has two const keywords after the function name declaration.

Am I missing some valid, esoteric use of const here? This seems invalid to me?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

It’s just a typo. There are no use cases that I know of for double const, so the usage of it twice is likely a programming error.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading