-
Notifications
You must be signed in to change notification settings - Fork 2
CPP Coding Questions
Lingfa Yang
When my friends consulted me C/C++ problems, I found some of their questions are great. So I collect them, and put answers together to share with you. If you have nice questions, or elegant codes to share, doesn't matter which levels, email me please. Playing codes is my hobbit.
![]() Bitwise logical operator:
const to specify an object or a variable is not modifiable.
Unicode, Universal Character Set(UCS), a single unified character set, are first of all just code tables that assign integer numbers to characters. Unicode started to replace ASCII, ISO 8859 and EUC at all levels. With the UTF-8 encoding, Unicode can be used in a convenient and backwards compatible way in environments that were designed entirely around ASCII, like Unix. UTF-8 (8-bit Universal Character Set/Unicode Transformation Format) is a variable-length character encoding for Unicode. GB 2312 is the registered internet name for a key official character set of the People's Republic of China, used for simplified Chinese characters. Win32 APIs categories:
GDI has a Device Context (DC) output to screen or printer. A DC, like most GDI objects, is opaque. GDI+ is an improved 2D graphics environment, adding advanced features such as anti-aliased 2D graphics, floating point coordinates, gradient shading, more complex path management, intrinsic support for modern graphics-file formats like JPEG and PNG, and general support for composition of affine transformations in the 2D view pipeline. GDI+ uses ARGB values to represent color. Windows Vista has Desktop Window Manager (DWM). DWM requires graphics cards supporting DirectX 9.0 and Shader Model 2.0. DWM uses DirectX to perform the function of compositing and rendering in the GPU, freeing the CPU of the task of managing the rendering from the off-screen buffers to the display. However, it does not affect applications painting to the off-screen buffers.
More ...
Example:
A function pointer is a type of pointer in C/C++ which points to the address of a function. Just like the normal function, a function pointer has type and zero or more arguments as signature. It is a programming technique used to simplify code (replace switch-statement) or impliment a callback function. Example 1: use function pointer to replace switch-statement.
Example 2: callback.
If you expect the callback will drive a progress bar in the same thread, you will finally get in trouble. Updating Windows is done main thread. Heavy duty job should be run in separate thread. More on this topic ... ![]()
![]() |