首页 | 官方网站   微博 | 高级检索  
相似文献
 共查询到20条相似文献,搜索用时 125 毫秒
1.
指针是C语言中的一个重要的概念,也是C语言的一个重要特色,正确而灵活地运用它可以使程序简洁、紧凑、高效,这对软件设计十分必要.但是指针概念比较复杂,应用也比较灵活且容易出错,学习者较难掌握,是C语言教学的难点,特别是指针与数组结合使学习者理解起来更加困难,本文从概念表示到应用分析由浅入深地讨论了指针数组与指向指针的指针.阐述了学习方法与教学经验.  相似文献   

2.
指针是C语言中的一个重要概念,正确熟练地掌握指针的概念和指针的使用就能设计出复杂的数据结构和高效的程序。在此重点论述了指针的概念及其在程序中的应用。  相似文献   

3.
李蓓 《数字社区&智能家居》2009,(11):8712-8713,8716
指针是C语言甲的一个重要概念,正确熟练地掌握指针的概念和指针的使用就能设计出复杂的数据结构和高效的程序。在此重点论述了指针的概念及其在程序中的应用。  相似文献   

4.
面向对象程序设计是一种实用的程序设计方法学,它采用全新的方法来求解问题.本文概述了面向对象程序设计方法的关键概念,同时着重介绍了一个基于面向对象概念的窗口软件OOWS,叙述了OOWS的设计、实现和应用.  相似文献   

5.
带指针算术的程序往往包含数组越界、缓冲区溢出等运行时错误。单纯的指针分析技术和数值分析技术都无法有效处理指针算术。为了将指针分析与数值分析相结合,首先提出一种新的指针内存模型,然后基于该模型设计了一个刻画指针指向关系和指针偏移量的抽象域。最后在抽象解释框架下,设计并实现了一个面向带指针算术C程序的静态分析工具原型PAA。实验结果表明,PAA能够有效地分析指针程序的指向关系和数值性质,并能够在效率和精度间取得合理的权衡。  相似文献   

6.
指针分析技术是一种基础的静态程序分析技术,也是软件安全方向的研究热点之一,在软件缺陷检测、恶意代码分析、程序验证、编译器优化等应用场景中发挥着重要的作用,指针分析的精度在这些应用场景中至关重要。流敏感分析和过程间分析是提高指针分析精度最有效的两种技术。文中对现有的提高过程间流敏感指针分析精度的技术进行总结,从为提高精度所消除的信息入手,将分析方法分为两大类:一类是消除分析中的虚假信息,以避免指向信息沿虚假的返回路径或是虚假调用关系传播;另一类是消除分析中保守的指向关系,在每个程序点处根据设置的规则尽可能确定指针的唯一指向,而不是笼统地计算指针的多个可能指向。据此,详细比较了过程间流敏感指针分析技术的异同,并对指针分析技术未来的研究方向进行了展望。  相似文献   

7.
C语言是面向过程的语言,C++是面向对象的语言,虽然它们是两种不同的程序设计语言,但是在基础语法的实际应用中有一些相似之处,也存在一些差别.结合程序实例,总结并详细分析了两种语言在布尔数据类型、字符串处理、指针与引用的参数传递等相关知识要点中的差异,阐述了原因,提出了应用的建议.  相似文献   

8.
许永达 《计算机系统应用》2013,22(3):153-156,181
C语言指针的有些错误在程序编译阶段难以发现,且现行教材主要从概念、理论上对指针错误进行讲述,存在不足.分析了带有此类错误的示例程序,并在VISUAL C++6.0进行调试,展示此类指针错误的错误现象,分析其产生的原因,提出正确使用指针的方法,以达到预防此类指针错误发生的目的.  相似文献   

9.
三、运行时类型识别(RTTI) RTTI(运行时类型识别)允许“用指向基类的指针或引用来操纵对象”的程序能够获取到“这些指针或引用所指对象”的实际类型(引自C primer)。运行时类型鉴定(RTTI)的概念初看非常简单——手上只有基础类型的一个指针时,利用它判断一个对象的正确类型。RTTI特性是面向对象特性中加入较晚的特性之一,但却是一个非常重要的特性。RTTI是面向对象程序设计中一种重要的技术,面向对象语言很多其他特性也是以它为基础的,例如异常机制的实现。同时它也为“多态性”提供了特殊的支持。  相似文献   

10.
面向对象指针技术是C、C++、VC系列编程语言的一个难点.对面向对象指针技术理解的深度和广度直接影响我们编程的质量和速度。该文从指针、指针数组、对象指针数组出发.进而分析了函数对象指针,最后分析了虚函数指针,使我们对面向对象指针技术有一个完整、彻底的理解和掌握。  相似文献   

11.
空指针解引用是C语言中的一类常见的动态内存错误。Manevich R等提出了一种适用于检测空指针解引用错误的后向分析方法。本文将后向分析的思想和流敏感、上下文敏感的指针分析结合在一起,给出了一种需求驱动的空指针解引用检测静态分析算法。该算法首先由指针分析获得别名信息,然后针对所关心的数据做后向数据流分析,追踪数据传递的源头,以确定程序中的表达式是否产生解引用错误。我们在SUIF2平台上实现了这一算法。实验结果表明,算法具有较高的检测精度。  相似文献   

12.
Pointer analysis statically approximates the heap pointer structure during a program execution in order to track heap objects or to establish alias relations between references, and usually contributes to other analyses or code optimizations. In recent years, a number of algorithms have been presented that provide an efficient, scalable, and yet precise pointer analysis. However, it is unclear how the results of these algorithms compare to each other semantically.In this paper, we present a general region type system for a Java-like language and give a formal soundness proof. The system is subsequently specialized to obtain a platform for embedding the results of various existing context-sensitive pointer analysis algorithms, thereby equipping the computed relations with a common interpretation and verification. We illustrate our system by outlining an extension to a string value analysis that builds on pointer information.  相似文献   

13.

Context

Pointer analysis is an important building block of optimizing compilers and program analyzers for C language. Various methods with precision and performance trade-offs have been proposed. Among them, cycle elimination has been successfully used to improve the scalability of context-insensitive pointer analyses without losing any precision.

Objective

In this article, we present a new method on context-sensitive pointer analysis with an effective application of cycle elimination.

Method

To obtain similar benefits of cycle elimination for context-sensitive analysis, we propose a novel constraint-based formulation that uses sets of contexts as annotations. Our method is not based on binary decision diagram (BDD). Instead, we directly use invocation graphs to represent context sets and apply a hash-consing technique to deal with the exponential blow-up of contexts.

Result

Experimental results on C programs ranging from 20,000 to 290,000 lines show that applying cycle elimination to our new formulation results in 4.5 ×speedup over the previous BDD-based approach.

Conclusion

We showed that cycle elimination is an effective method for improving the scalability of context-sensitive pointer analysis.  相似文献   

14.
通过基于包含的指针分析在线优化技术中的纵向传播方法,改进基于调用图上下文敏感指针分析的环消除技术,提出一种上下文敏感的纵向传播算法。初始化约束图,在约束图中进行环探测及其合并,执行差异传播并循环处理复杂约束,直到一次调用纵向传播例程后图中所有结点指向集不变为止,从而得到图中各结点到其指向集的映射。应用CIL工具的实验结果表明,该算法能有效地对源程序进行上下文敏感的指针分析,与环消除技术相比,在分析大规模程序时具有更高的时间效率。  相似文献   

15.
Context-sensitivity is an important expected capability in applications in ubiquitous computing (ubicomp) environments. These applications need to use different contextual information from the user, host device, on board sensors, network, and the ambient environments to systematically adapt their actions. In addition, some context-sensitive applications may use specific contextual conditions to trigger impromptu and possibly short-lived interactions with applications in other devices. This property, referred to as context-sensitive or context-aware communications, allows applications to form short-range mobile ad hoc networks consisting of mobile and stationary devices, sensors, and other computing resources. Real-time applications, especially those having reactive behavior, running on embedded devices and requiring context-sensitive communications support, pose new challenges related to systematic representation of specific contexts, associations of contexts with real-time actions, timely context data collection and propagation, and transparent context-sensitive connection establishment. An object-based middleware can be effective to meet these challenges if such a middleware can provide a well-defined development framework as well as lightweight runtime services. In this paper, an adaptive and object-based middleware, called reconfigurable context-sensitive middleware (RCSM) is presented to facilitate context-sensitive communications in ubicomp environments. To facilitates context-sensitive communications, RCSM provides a context-aware interface definition language for specifying context-sensitive interfaces of real-time objects, an object container framework for generating interfaces-specific context-analyzers, and a context-sensitive object request broker for context-sensitive object discovery and impromptu connection management. RCSM is adaptive in the sense that depending on the context-sensitive behavior of the applications, it adapts its object discovery and connection management mechanisms.  相似文献   

16.
C语言是一门优秀的语言,其在多个领域都有着很好的应用。指针是C语言的精华所在。本文阐述了指针的概念,对指针的常见类型进行了分析,并对指针的运算和相关应用做了详细的实例讲解,有效引入了指针对数组和函数的调用,对具体问题进行了讲解。  相似文献   

17.
C++语言是当前十分流行的、面向对象程序设计语言。通过对C++语言的深入研究以及较多的编程实践,总结归纳了C++语言的知识体系和编程中的几个常见问题,比如构造函数、对象指针、const数据和成员的访问属性等,对这些容易搞混淆的问题逐一进行详尽的分析和说明,并解释了其原因所在。通过阅读该文可为编程者带来有益的帮助,以便编程中碰到同类问题时能够解决。  相似文献   

18.
定值-引用类错误是一类非常重要且常见的错误.当前,对这类错误的检测很难同时达到高精度和高可扩展性.通过合理组合敏感和不敏感的检测方法并控制两类方法的实施范围,可以同时达到高检测精度和高可扩展性.提出一种新颖的场景敏感的检测方法,该方法根据触发状态对潜在错误语句分类,识别不同类别语句的触发场景并实施不同开销的检测,在不降低精度的同时最小化检测开销.设计了一个多项式时间复杂度的流敏感、域敏感和上下文敏感的场景分析以进行分类,并基于程序依赖信息识别触发场景,仅对必要的触发场景实施路径敏感的检测.为上述方法实现了一种原型系统——Minerva.通过使用空指针引用错误检测为实例研究以及总代码规模超过290万行,最大单个应用超过200万行的应用验证,用例实验结果表明,Minerva的平均检测时间比当前先进水平的路径敏感检测工具Clang-sa和Saturn分别快3倍和46倍.而Minerva的误报率仅为24%,是Clang-sa和Saturn误报率的1/3左右,并且Minerva未发现漏报已知错误.上述数据表明,所提出的场景敏感的错误检测方法可同时获得高可扩展性和高检测精度.  相似文献   

19.
C语言作为一种“高级的低级“语言,成为嵌入式系统开发的最佳选择.在嵌入式程序设计中灵活地使用C指针,可以使程序简洁、紧凑、高效,会达到很好的效果.文章主要从数据指针、动态申请内存指针引用数组元素、函数指针几个方面阐述了C指针在嵌入式编程中的应用.  相似文献   

20.
We present a demand-driven approach to memory leak detection algorithm based on flow- and context-sensitive pointer analysis. The detection algorithm firstly assumes the presence of a memory leak at some program point and then runs a backward analysis to see if this assumption can be disproved. Our algorithm computes the memory abstraction of programs based on points-to graph resulting from flow- and context-sensitive pointer analysis. We have implemented the algorithm in the SUIF2 compiler infrastructure and used the implementation to analyze a set of C benchmark programs. The experimental results show that the approach has better precision with satisfied scalability as expected. This work is supported by the National Natural Science Foundation of China under Grant Nos. 60725206, 60673118, and 90612009, the National High-Tech Research and Development 863 Program of China under Grant No. 2006AA01Z429, the National Basic Research 973 Program of China under Grant No. 2005CB321802, the Program for New Century Excellent Talents in University under Grant No. NCET-04-0996, and the Hunan Natural Science Foundation under Grant No. 07JJ1011.  相似文献   

设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司    京ICP备09084417号-23

京公网安备 11010802026262号