Pointerminator

Abstract

Pointers and Arrays as inherited from C are still in heavy use in C++ programs. They are used to represent strings, arrays, objects on the heap or they appear in function signatures to do call-by-reference. However, issues like resource responsibility, degradation of an array to a pointer loosing its dimension or zero termination of byte sequences lead to poor quality and potential security problems. Modern C++ and its standard library provide a lot of functionality to avoid the use of raw pointers and arrays. If those concepts are applied correctly, they can lead to much better and more maintainable code. The goal of our term project is to write a plug-in for Eclipse CDT that allows a programmer to find and automatically refactor pieces of code, that use pointers in an unfavourable way. We started with an analysis of the various roles pointers can have. Based on that analysis we decided that the plug-in should be able to refactor C strings, C arrays and pointer parameters. Then we implemented the plug-in and documented its architecture. Finally, we tested the plug-in in the code base of an existing C++ application called fish shell. The results of these tests allowed us to optimize the plug-in and to fix some of the problems that we discovered during testing

    Similar works

    Full text

    thumbnail-image

    Available Versions