-
June 15th, 2017, 07:29 AM
#1
The Evil within the Comparison Functions
Programmers are very attentive people. The specifics of their work is that even one typo can break the logic of the whole program. Such errors can be detected by specialized code analysis tools. But still, it would be very interesting to see if there are any error patterns: what errors appear in functions most often? Well, one C/C++ developer, a Microsoft MVP, decided to find an answer for this question.
As it turned out, one of the most frequent errors occurs in simple comparison functions: IsEqual, Equals, Compare, AreEqual and so on, ot in overloaded operators, such as ==, !=. At first glance it may seem that the comparison functions are so simple and trivial, that they don’t need any unit tests or checks by additional code analysis tools, but perhaps, developers just underestimate them, thinking that they are too banal. You may see this phenomenon in the article “The Evil within the Comparison Functions”.
-
June 18th, 2017, 12:14 AM
#2
Re: The Evil within the Comparison Functions
 Originally Posted by El_programmer
As it turned out, one of the most frequent errors occurs in simple comparison functions: IsEqual, Equals, Compare, AreEqual and so on,
Well, boiled down to Turing completeness, programming consists of just two activities namely comparing things and putting things in sequence. Intuitively, comparing things takes more brainpower than doing things in the right order so I would not be surprised if it were found to be the most error-prone of the two.
Last edited by wolle; June 18th, 2017 at 02:13 AM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|