一句话:提出编译期静态检查器 SPrinter,检测 C++ 智能指针的不良用法并提示易错行为。
智能指针在现代 C++ 中被广泛用于防止内存错误,但其不当使用同样会引发常见的内存错误,使代码并不像预期那样安全。为尽早发现此类问题,作者提出了编码风格检查器 SPrinter,在编译期检测可能有害的智能指针用法,并向程序员提示易出错的写法。评估表明,现有最先进的静态代码检查器在 116 个人工注入的错误中仅能检出 25 个,而 SPrinter 能够全部检出;此外,作者在 8 个开源项目中发现了 521 个缺陷,且仅有 4 个误报。
Smart pointers are widely used to prevent memory errors in modern C++ code. However, improper usage of smart pointers may also lead to common memory errors, which makes the code not as safe as expected. To avoid smart pointer errors as early as possible, we present a coding style checker to detect possible bad smart pointer usages during compile time, and notify programmers about bug-prone behaviors. The evaluation indicates that the currently available state-of-the-art static code checkers can only detect 25 out of 116 manually inserted errors, while our tool can detect all these errors. And we also found 521 bugs among 8 open source projects with only 4 false positives.
DOI 原文 ·
@inproceedings{paperbot5268,
title = {SPrinter: A Static Checker for Finding Smart Pointer Errors in C++ Programs},
author = {Xutong Ma and Jiwei Yan and Yaqi Li and Jun Yan and Jian Zhang},
booktitle = {ASE},
year = {2019},
doi = {10.1109/ase.2019.00117}
}