Cpp
C and C++
I was reading my email when I came across this blog about the death of single-threaded development. Now I've written many multi-threaded applications in C++ for applications, communications, and graphical displays, but I don't see the death of single-threaded development any time soon. I even wrote a paper while I was at university about how multi-threaded programming should be introduced in the curriculum much earlier. At the very least, the multi-threaded thought process should be taught but I don't see that happening. Samples are usually distributed as single-threaded applications because they are easier to understand. Unfortunately people replicate the same...
One of the strangest programming concepts that I came across was working with an embedded processor, Analog Devices SHARC ADSP-21062, on a project. I was shocked when I found out the following:
sizeof(char) == sizeof(short) == sizeof(int) == 1
I didn't think this was possible, but sure enough it was. After reviewing the C standard I realized that this was allowed and the only requirement was: sizeof(char) <= sizeof(short) <= sizeof(int).
This actually had a profound affect on a later project using the same processor family when I was porting an embedded GUI, Nano-X or formerly microwindows, to that processor. The issue was...
When I was debugging communication protocols a long time ago, I would often have to convert a 32-bit integer into a 32-bit floating point number. This did not mean using atof, fscanf, _fcvt or similar function, but rather interpretting the bits as an IEEE 754 or IEC 60559:1989 floating point number. An example would be:
1.0 == 0x3F800000 (1065353216)
In the process, I wrote a tool that displays the components of the floating point number and allows you to change the raw hexadecimal bits. Here is a screen shot:
This tool was written with VB6 however I have always wanted to make a C++/WTL...