September 21st, 2012, 04:12 AM
Selected articles from the Viva64 website for C/C++ programmers
We regularly publish articles on our website on the subjects of programming, writing quality code, developing concurrent and 64-bit software. We also tell interesting stories about errors found by the PVS-Studio analyzer.
As a result, we have gathered a lot of materials on our site. One who happens to visit it might not know about the interesting materials collected there. Many people have also joined us, for example, in Twitter. They see our new articles but donít know that we have wonderful old ones.
Iíve decided to pick out some materials that programmers may like most. Iím asking those of you who have already read them Ė please donít tell the rest about it and donít give negative marks. I want you to understand that the audience is changing quite rapidly. One year later, in a certain group of people, there will be one person familiar with an article against 5 persons unfamiliar with it.
Here are the selected materials and brief description.
About 64-bit development
A Collection of Examples of 64-bit Errors in Real Programs
This article is the most complete collection of examples of 64-bit errors in the C and C++ languages. The article is intended for Windows-application developers who use Visual C++, however, it will be useful for other programmers as well.
A 64-bit horse that can count
The phenomenon of "The Clever Hans", Mr. von Osten's horse, was described in 1911. The Clever Hans was famous because of his ability to read and solve mathematical problems by tapping with his front hoof. Of course, there were a lot of skeptics. That's why a team of experts tested Hans' abilities and proved that the horse was showing them without any help of Mr. von Osten. But how could a common horse possess such an intellectual level - a human one?! The psychologist O. Pfungst carried out some very thorough experiments and discovered that Hans received very faint unintentional hints from those who were asking him questions. For example, when people asked Hans about anything they started to stare at his front hoof with the help of which the horse "answered". But as soon as Hans had tapped the right number, they raised their eyes or head just a little waiting for him to finish his answer. And the horse, that had been trained to note and use these very subtle motions considered them as signals to stop his action. From aside it looked as if the horse had given the right answer to the question.
Such a wonderful horse it was that counted and solved arithmetic problems although he was unable to do it. 64-bit programs turned out to be such digital horses of the beginning of the 21st century, many of which cannot count either although are successful in pretending to do so. Let's consider this phenomenon in detail.
Lessons on development of 64-bit C/C++ applications
The course is devoted to creation of 64-bit applications in C/C++ language and is intended for the Windows developers who use Visual Studio 2005/2008/2010 environment. Developers working with other 64-bit operating systems will learn much interesting as well. The course will consider all the steps of creating a new safe 64-bit application or migrating the existing 32-bit code to a 64-bit system.
The course is composed of 28 lessons devoted to introduction to 64-bit systems, issues of building 64-bit applications, methods of searching errors specific to 64-bit code and code optimization. Such questions are also considered as estimate of the cost of moving to 64-bit systems and rationality of this move.
Wade not in unknown waters
We decided to write several small posts on how C/C++ programmers play with fire without knowing it. The first post will be devoted to an attempt to explicitly call a constructor.
This time I want to speak on the 'printf' function. Everybody has heard of software vulnerabilities and that functions like 'printf' are outlaw. But it's one thing to know that you'd better not use these functions, and quite the other to understand why. In this article, I will describe two classic software vulnerabilities related to 'printf'. You won't become a hacker after that but perhaps you will have a fresh look at your code. You might create similar vulnerable functions in your project without knowing that.
STOP. Reader, please stop, don't pass by. You have seen the word "printf", I know. And you're sure that you will now be told a banal story that the function cannot check types of passed arguments. No! It's vulnerabilities themselves that the article deals with, not the things you have thought. Please come and read it.
I'm going on to tell you about how programmers walk on thin ice without even noticing it. Let's speak on shift operators <<, >>. The working principles of the shift operators are evident and many programmers even don't know that using them according to the C/C++ standard might cause undefined or unspecified behavior.
The compiler is to blame for everything
Many programmers are very fond of blaming the compiler for different errors. Let's talk about it.
100 bugs in Open Source C/C++ projects
This article demonstrates capabilities of the static code analysis methodology. The readers are offered to study the samples of one hundred errors found in open-source projects in C/C++.
Consequences of using the Copy-Paste method in C++ programming and how to deal with it
I have collected a lot of examples demonstrating that an error occurred because of copying and modifying a code fragment. Of course, it has been known for a long time that using Copy-Paste in programming is a bad thing. But let's try to investigate this problem closely instead of limiting ourselves to just saying "do not copy the code".
32 OpenMP Traps For C++ Developers
Since multi-core systems are spreading fast, the problem of parallel programming becomes more and more urgent. However, even the majority of experienced developers are new to this sphere. The existing compilers and code analyzers allow finding some bugs, which appear during parallel code development. However, many errors are not diagnosed. The article contains description of a number of errors, which lead to incorrect behavior of parallel programs created with OpenMP.
About advertising for programmers
Studying methods of attracting people to a software product's website
This article will be of interest to those who promote proprietary software products on the Internet. So, the article is of absolutely practical character. It is a report of what we have been doing for some time already to promote our product PVS-Studio. I will tell you about the things that work, the things that don't work, and share my thoughts related to this subject.
Is it reasonable to use the prefix increment operator ++it instead of postfix operator it++ for iterators?
I decided to find out if there is practical sense in writing ++iterator instead of iterator++ when handling iterators. My interest in this question arouse far not from my love to art but from practical reasons. We have intended for a long time to develop PVS-Studio not only in the direction of error search but in the direction of prompting tips on code optimization. A message telling you that you'd better write ++iterator is quite suitable in the scope of optimization.
Collection of interesting resources on C/C++ programming
I also invite you to join us in one of the following networks:
Tags for this Thread
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!