摘要
本文讨论C/C++程序设计中等于运算符的两种常见使用错误,即与赋值运算符混淆和用来判别两个浮点数是否相等。从程序员的角度给出了减少与赋值运算符混淆,以及不同情况下正确判别两个浮点数是否相等的方法。并利用VC 6.0设计了一个Add-in程序,能够自动发现有可能出现这两种错误的语句,提醒程序员注意,以便从集成开发环境的角度减少错误。
Two kinds of common use errors of equality operator in C/C + + programming are discussed,one is to confuse with assignment operator and the other is to determine whether two floating point numbers are equal. For the programmers,some methods to reduce confusion with assignment operator and determine whether two floating point numbers are equal under different conditions are given. An Add- in is developed with VC 6. 0 to find where maybe appear these kinds of errors and to notify the programmer to examine his program,thus to reduce the probability of errors from the perspective of the integrated development environment.
出处
《中州大学学报》
2016年第2期112-115,共4页
Journal of Zhongzhou University