期刊文献+
共找到1篇文章
< 1 >
每页显示 20 50 100
Source-to-Source Refactoring and Elimination of Global Variables in C Programs
1
作者 Hemaiyer Sankaranarayanan prasad a. kulkarni 《Journal of Software Engineering and Applications》 2013年第5期264-273,共10页
A global variable in C/C++ is one that is declared outside a function, and whose scope extends the lifetime of the entire program. Global variables cause problems for program dependability, maintainability, extensibil... A global variable in C/C++ is one that is declared outside a function, and whose scope extends the lifetime of the entire program. Global variables cause problems for program dependability, maintainability, extensibility, verification, and thread-safety. However, global variables can also make coding more convenient and improve program performance. We have found the use of global variables to remain unabated and extensive in real-world software. In this paper we present a source-to-source refactoring tool to automatically detect and localize global variables in a program. We implement a compiler based transformation to find the best location to redefine each global variable as a local. For each global, our algorithm initializes the corresponding new local variable, passes it as an argument to necessary functions, and updates the source lines that used the global to now instead use the corresponding local or argument. We also characterize the use of global variables in standard benchmark programs. We study the effect of our transformation on static program properties, such as change in the number of function arguments and program state visibility. Additionally, we quantify dynamic program features, including memory and runtime performance, before and after our localizing transformation. 展开更多
关键词 GLOBAL Variable Program REFACTORING COMPILER TRANSFORMATIONS
下载PDF
上一页 1 下一页 到第
使用帮助 返回顶部