Show Formatted Source Code with Syntax Highlight

LibG Code Viewer is a free web tool to view source code with syntax highlight.
After I finished my post How to format source code in your blog, I decided to make a small tool for anyone who post source code file on Internet. I called this tool “LibG Code Viewer“, it used the method I described in my previous blog. …


How to format source code in your blog

When I was writing my post Include Guard: #pragma once vs. #ifndef #define #endif, I searched from Internet and tried at least 5 WordPress plug-in to insert formatted source code. But none of them works well for me. Some can not support C++ source code, some insert complicated html code to my post. Finally I found syntax highlighting is simply …


Performance: encapsulate floating point and built-in tolerance

When it comes to the floating point comparison with tolerance, two approaches come into my mind.
The first approach is to write inline functions and call them when compare floating point numbers. It is easy to understand and is widely used by numerous applications. Yes, it is really simple and I like it. The only concern is that I have to …


Comparison of Float and Double Precision

C++ supports two primitive floating point types: float and double. These are based on the IEEE 754 standard, which defines a binary standard for 32-bit floating point and 64-bit double precision floating point binary-decimal numbers. IEEE 754 represents floating point numbers as base 2 decimal numbers in scientific notation. An IEEE floating point number dedicates 1 bit to the sign …


Include Guard: #pragma once vs. #ifndef #define #endif

In the C and C++ programming languages, an include guard, sometimes called a macro guard, is a particular construct used to avoid the problem of double inclusion when dealing with the #include directive. The addition of include guards to a header file is one way to achieve this. pragma once is a non-standard but widely supported preprocessor directive designed to …


«12