Blogs (28) >>
ECOOP 2016
Sun 17 - Fri 22 July 2016 Rome, Italy

The ability to specify immutability in a programming language is a powerful tool for developers, enabling them to better understand and more safely transform the code without fearing side effects. Some mainstream languages, such as C and C++, allow developers to specify a form of immutability using the const keyword. In this work, we characterize the meaning of the C/C++ const qualifier and present the ConstSanitizer tool, which dynamically identifies const uses in practice that are either not consistent with transitive immutability, write to mutable fields, or write to formerly-const objects whose const-ness has been casted away. Based on a set of 8 benchmark programs, we classify such uses of const according to a set of attributes (namely: synchronized, not visible, buffer/cache, delayed initialization, and incorrect). Our work contributes to the understanding of a widely-used C/C++ language feature.