The long arrow operator in C++

Sometimes, we need to create wrapper types. For example, types like unique_ptrshared_ptroptional and similar.

Usually, these types have an accessor member function called .get but they also provide the operator-> to support direct access to the contained value similarly to what ordinary pointers do.
unnamed

Continue reading

2038: only 21 years away

Sometimes it seems that things have gone relatively quiet on the year-2038 front. But time keeps moving forward, and the point in early 2038 when 32-bit time_t values can no longer represent times correctly is now less than 21 years away. That may seem like a long time, but the relatively long life cycle of many embedded systems means that some systems deployed today will still be in service when that deadline hits. One of the developers leading the effort to address this problem is Arnd Bergmann; at Linaro Connect 2017 he gave an update on where that work stands.

Picture 1

Continue reading

The Ultimate List of Resources to Learn C and C++

The C programming language was originally developed for and implemented on the UNIX operating system by Dennis Ritchie. C, a quite simple language, is not tied to any particular hardware or system. This makes it easy for a user to write programs that will run without any changes on practically all machines.

Continue reading

Top 10 bugs in C++ open source projects, checked in 2016

While the world is discussing the 89th Ceremony of Oscar award and charts of actors and costumes, we’ve decided to write a review article about the IT-sphere. The article is going to cover the most interesting bugs, made in open source projects in 2016. This year was remarkable for our tool, as PVS-Studio has become available on Linux OS. The errors we present are hopefully, already fixed, but every reader can see how serious are the errors made by developers.

Picture 6 Continue reading

The real difference between struct and class

“Should I use a struct or a class?”

Such is the question many C++ programmers ask themselves, or ask around to more experienced co-workers, when designing their code.

coding

There is sometimes a cloud of misconception about what the difference between struct and class technically is, particularly amongst the youngest developers. And once we get to understand the technical difference, some degree of uncertainty often remains about which one to use in a given context. Sometimes developers even disagree about which is the more appropriate in their code.
Continue reading