CharWars Rise of the fallen strings: Replace C-String Library calls with C++ std::string Operations

Gonzalez, Fabian and Suter, Toni (2014) CharWars Rise of the fallen strings: Replace C-String Library calls with C++ std::string Operations. Bachelor thesis, HSR Hochschule für Technik Rapperswil.

[thumbnail of CharWars_eprint.pdf]
Preview
Text
CharWars_eprint.pdf - Supplemental Material

Download (1MB) | Preview

Abstract

C strings are still in heavy use in C++ programs. Additionally, standardized C functions such as strcpy() and strstr() are often used to modify or analyze the content of the strings. Unfortunately, because of the fact that a C string is just a pointer to a zero-terminated character array, those functions have a lot of drawbacks regarding performance, safety and readability. The std::string class from the C++ standard library and its member functions provide a lot of the same functionality without these downsides. Building on previous work from our term project Pointerminator we extended the existing Eclipse CDT plug-in so that it helps a programmer to find and automatically refactor pieces of code, that use C strings in an unfavourable way. We started with an analysis of the various ways C strings and their related C functions are used in practice. Based on that analysis we defined possible refactorings for a subset of the standardized C string functions. We then added this functionality to the existing plug-in, wrote corresponding unit tests and documented its architecture. Finally, we tested the plug-in in the code base of an open source C++ application called XBMC. The results of these tests allowed us to optimize the plug-in and to fix some of the problems that we discovered during testing.

Item Type: Thesis (Bachelor)
Subjects: Topics > Software > Refactoring
Area of Application > Development Tools
Technologies > Programming Languages > C++
Technologies > Programming Languages > C
Technologies > Frameworks and Libraries > Eclipse
Metatags > IFS (Institute for Software)
Divisions: Bachelor of Science FHO in Informatik > Bachelor Thesis
Depositing User: OST Deposit User
Contributors:
Contribution
Name
Email
Thesis advisor
Sommerlad, Peter
UNSPECIFIED
Date Deposited: 08 Oct 2014 08:48
Last Modified: 08 Oct 2014 08:48
URI: https://eprints.ost.ch/id/eprint/373

Actions (login required)

View Item
View Item