51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 2485|回复: 2
打印 上一主题 下一主题

高手帮忙翻译一下

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2005-7-19 15:15:56 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
Data Reference Errors
1. Does a referenced variable have a value that is unset or unini-
tialized? This probably is the most frequent programming
error; it occurs in a wide variety of circumstances. For each
reference to a data item (variable, array element, field in a
structure), attempt to “prove” informally that the item has a
value at that point.
2. For all array references, is each subscript value within the
defined bounds of the corresponding dimension?
3. For all array references, does each subscript have an integer
value? This is not necessarily an error in all languages, but it
is a dangerous practice.
4. For all references through pointer or reference variables, is
the referenced memory currently allocated? This is known as
the “dangling reference” problem. It occurs in situations
where the lifetime of a pointer is greater than the lifetime of
the referenced memory. One situation occurs where a
pointer references a local variable within a procedure, the
pointer value is assigned to an output parameter or a global
variable, the procedure returns (freeing the referenced loca-
tion), and later the program attempts to use the pointer
value. In a manner similar to checking for the prior errors,
try to prove informally that, in each reference using a pointer
variable, the reference memory exists.
5.  When a memory area has alias names with differing attributes,
does the data value in this area have the correct attributes
when referenced via one of these names? Situations to look
for are the use of the EQUIVALENCE  statement in FORTRAN,
and the  REDEFINES  clause in COBOL. As an example, a
FORTRAN program contains a real variable A and an integer
variable B;both are made aliases for the same memory area by
using an EQUIVALENCE   statement. If the program stores a value
into A and then references variable B, an error is likely present
since the machine would use the floating-point bit representa-
tion in the memory area as an integer.
6. Does a variable’s value have a type or attribute other than
what the compiler expects? This situation might occur where
a C, C++, or COBOL program reads a record into memory
and references it by using a structure, but the physical repre-
sentation of the record differs from the structure definition.
7. Are there any explicit or implicit addressing problems if, on
the machine being used, the units of memory allocation are
smaller than the units of memory addressability? For instance,
in some environments, fixed-length bit strings do not neces-
sarily begin on byte boundaries, but addresses only point to
byte boundaries. If a program computes the address of a bit
string and later refers to the string through this address, the
wrong memory location may be referenced. This situation
also could occur when passing a bit-string argument to a
subroutine.
8. If pointer or reference variables are used, does the referenced
memory location have the attributes the compiler expects?
An example of such an error is where a C++ pointer upon
which a data structure is based is assigned the address of a dif-
ferent data structure.
9. If a data structure is referenced in multiple procedures or
subroutines, is the structure defined identically in each proce-
dure?
10. When indexing into a string, are the limits of the string off-
by-one errors in indexing operations or in subscript refer-
ences to arrays?
11. For object-oriented languages, are all inheritance require-
ments met in the implementing class?


[ Last edited by ylximu on 2005-7-21 at 08:34 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

3#
 楼主| 发表于 2005-7-21 12:08:03 | 只看该作者

我自己翻译了一下,大家帮忙指正

数据引用错误
1.        是否有值的引用变量未定义或未初始化?这是最常发生的程序错误;出现在广阔的多样环境中。对于每一条数据中的引用(变量,数组元素,结构体区域),由于在那里有值从而尝试着检查非正式性。
2.        对于所有的数组引用,是否每个后面的值都在相应的定义尺度范围以内?
3.        对于所有的数组引用,是否每个后面的值都有一个整数值?在所有的语言中,这不是必要的错误,但这是一个危险的习惯。
4.        对于所有通过指针或引用变量的引用,是否在当前分配了引用寄存器?这就是“摇摆引用”问题。它在指针的存活时间大于引用寄存器的存活时间的情形下出现。一种情形出现在当一个指针涉及到一个在程序内的本地变量,指针的值被分配到一个输出参量或者一个全局变量,程序返回(释放引用的位置),然后尝试使用指针的值。在某种意义上相似的检查预先错误,在每一个使用指针变量的引用中,设法证明引用寄存器的存在是非正式的.
5.        当一个存储区有不同属性的名字,引用使用其中一个名字时,这个区域的数据值是否具有正确的属性?这种情形在使用FORTRAN语言的EQUIVALENCE声明和COBOL语言的REDEFINES语句的时候可以找出。举个例子,一个包含实变量A和整变量B的的FORTRAN程序,两个都用EQUIVALENCE声明,在同一个寄存区域中被命名。如果一个程序在A中赋值然后涉及变量B,由于机器在寄存器中将使用浮点数表示法来作为整数,一个错误很有可能就出现了。
6.        变量的值是否具有和编译器的期望不同的类型和属性?这种情况可能在一个C,C++或者CCOBOL程序把一条记录读进寄存器并且用一个结构体引用的时候发生,但是记录的物理表示法与结构定义不同.
7.        在使用机器的时候,如果寄存器单元的分配比地址寄存器单元小,是否存在直白的或隐晦的选址问题?例如,在某些环境中,固定长度的字符串不需要从字节界限开始,而地址指向字节界限。如果一个程序先计算一个字符串的地址,然后通过这个地址引用这个字符串,错误的寄存器地址将可能被引用到。这种情形在传递一个字符串的结果给子程序的时候也可能发生。
8.        指针或者引用变量如果被使用,引用寄存器的地址是否具有编译器所期望的属性?这种错误的一个例子是:一个建立了数据结构的C++指针被分配了另一种数据结构的地址。
9.        如果一个数据结构在多个程序或者子程序中被引用,在每一个子程序中定义的结构体是否相同?
10.        当给一个字符串作索引的时候,在索引操作或者向下的数组引用中,限定的字符串是否具有大小差一(off-by-one)的错误?
11.        对于面向对象的语言,所有的继承条件是否与实现类一致?
回复 支持 反对

使用道具 举报

该用户从未签到

2#
发表于 2005-7-20 13:03:34 | 只看该作者
就是 dynamic data flow analysis 的东西
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-11-27 05:56 , Processed in 0.068361 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表