Rejuvenating C++ Programs through Demacrofictation
As we migrate software to new versions of programming languages, we would like to improve the style of its design and implementation by replacing brittle idioms and abstractions with the more robust features of the language and its libraries. This process is called source code rejuvenation. In this...
Main Author: | |
---|---|
Other Authors: | |
Format: | Others |
Published: |
2013
|
Subjects: | |
Online Access: | http://hdl.handle.net/1969.1/148432 |
id |
ndltd-tamu.edu-oai-repository.tamu.edu-1969.1-148432 |
---|---|
record_format |
oai_dc |
spelling |
ndltd-tamu.edu-oai-repository.tamu.edu-1969.1-1484322013-03-16T03:51:49ZRejuvenating C++ Programs through DemacrofictationAditya Kumar, -C PreprocessorMacrosSoftware Maintenancecpp2cxxC++11C++Software EngineeringDemacroficationRejuvenationAs we migrate software to new versions of programming languages, we would like to improve the style of its design and implementation by replacing brittle idioms and abstractions with the more robust features of the language and its libraries. This process is called source code rejuvenation. In this context, we are interested in replacing C preprocessor macros in C++ programs with C++11 declarations. The kinds of problems engendered by the C preprocessor are many and well known. Because the C preprocessor operates on the token stream independently from the host language’s syntax, its extensive use can lead to hard-to-debug semantic errors. In C++11, the use of generalized constant expressions, type deduction, perfect forwarding, lambda expressions, and alias templates eliminate the need for many previous preprocessor-based idioms and solutions. Additionally, these features can be used to replace macros from legacy code providing better type safety and reducing software-maintenance efforts. In order to remove the macros, we have established a correspondence between different kinds of macros and the C++11 declarations to which they could be trans- formed. We have also developed a set of tools to automate the task of demacrofying C++ programs. One of the tools suggest a one-to-one mapping between a macro and its corresponding C++11 declaration. Other tools assist in carrying out iterative application of refactorings into a software build and generating rejuvenated programs. We have applied the tools to seven C++ libraries to assess the extent to which these libraries might be improved by demacrofication. Results indicate that between 52% and 98% of potentially refactorable macros could be transformed into C++11 declarations.Stroustrup, Bjarne2013-03-14T16:26:23Z2013-03-14T16:26:23Z2012-122012-12-04December 20122013-03-14T16:26:23ZThesistextapplication/pdfhttp://hdl.handle.net/1969.1/148432 |
collection |
NDLTD |
format |
Others
|
sources |
NDLTD |
topic |
C Preprocessor Macros Software Maintenance cpp2cxx C++11 C++ Software Engineering Demacrofication Rejuvenation |
spellingShingle |
C Preprocessor Macros Software Maintenance cpp2cxx C++11 C++ Software Engineering Demacrofication Rejuvenation Aditya Kumar, - Rejuvenating C++ Programs through Demacrofictation |
description |
As we migrate software to new versions of programming languages, we would like to improve the style of its design and implementation by replacing brittle idioms and abstractions with the more robust features of the language and its libraries. This process is called source code rejuvenation. In this context, we are interested in replacing C preprocessor macros in C++ programs with C++11 declarations.
The kinds of problems engendered by the C preprocessor are many and well known. Because the C preprocessor operates on the token stream independently from the host language’s syntax, its extensive use can lead to hard-to-debug semantic errors. In C++11, the use of generalized constant expressions, type deduction, perfect forwarding, lambda expressions, and alias templates eliminate the need for many previous preprocessor-based idioms and solutions. Additionally, these features can be used to replace macros from legacy code providing better type safety and reducing software-maintenance efforts.
In order to remove the macros, we have established a correspondence between different kinds of macros and the C++11 declarations to which they could be trans- formed. We have also developed a set of tools to automate the task of demacrofying C++ programs. One of the tools suggest a one-to-one mapping between a macro and its corresponding C++11 declaration. Other tools assist in carrying out iterative application of refactorings into a software build and generating rejuvenated programs. We have applied the tools to seven C++ libraries to assess the extent to which these libraries might be improved by demacrofication. Results indicate that between 52% and 98% of potentially refactorable macros could be transformed into C++11 declarations. |
author2 |
Stroustrup, Bjarne |
author_facet |
Stroustrup, Bjarne Aditya Kumar, - |
author |
Aditya Kumar, - |
author_sort |
Aditya Kumar, - |
title |
Rejuvenating C++ Programs through Demacrofictation |
title_short |
Rejuvenating C++ Programs through Demacrofictation |
title_full |
Rejuvenating C++ Programs through Demacrofictation |
title_fullStr |
Rejuvenating C++ Programs through Demacrofictation |
title_full_unstemmed |
Rejuvenating C++ Programs through Demacrofictation |
title_sort |
rejuvenating c++ programs through demacrofictation |
publishDate |
2013 |
url |
http://hdl.handle.net/1969.1/148432 |
work_keys_str_mv |
AT adityakumar rejuvenatingcprogramsthroughdemacrofictation |
_version_ |
1716578947687251968 |