Yongwei's Programming Page

Mozi

Mozi is my new collection of C++ experimental utilities in Open Source. It currently includes code for C++17-based static reflection.

Libunibreak

Libunibreak is an open-source implementation of the line and word breaking algorithms as described in Unicode Standard Annexes 14 and 29. Line and word splitting is much more than breaking at the spaces (the Chinese Web world often sucks at this)!

Nvwa

Nvwa is my small collection of C++ utilities. It includes a memory leakage detector, a ‘ static’ memory pool, a thread transparency layer, and other such stuff.

Geek Time Courses

I have a C++ course and a Vim course on Geek Time. If you happened to be interested in these topics (and know Chinese), you might want to take a look.

我为极客时间写了一个 C++ 专栏和一个 Vim 专栏。如果你对这些内容有兴趣的话,也许可以去看一下。

Translations

I was part of a team that translated Bjarne Stroustrup’s HOPL4 paper: ‘Thriving in a Crowded and Changing World: C++ 2006–2020’. Highly recommended for all C++ users.

我参与了一项团队工作,协助翻译了 Bjarne Stroustrup HOPL4 论文 《在纷繁多变的世界里茁壮成长:C++ 2006–2020 。向所有 C++ 用户大力推荐。

In 2022, a few C++ advocates and I translated Rainer Grimm’s C++ Core Guidelines Explained into Chinese. This Chinese version is finally available now.

我和一些 C++ 爱好者在 2022 年翻译了赖纳·格林的C++ Core Guidelines 解析 。目前该中文版已经出版。

I was honoured to be one of the three translators of a very good old book, Programmers At Work. You can find out more details (in Chinese) in the link of the Chinese translation.

我很荣幸地参加了《编程大师访谈录》的翻译工作。这本书有点年头了,但今天看仍很有意义。

Articles

C++ compile-time programming: past, present, and futurenew (2024-10-11; Overload version October 2024)

Should we use std::printf in C++? (2023-10-22)

C++ exceptions and memory allocation failure (2023-08-17; Overload version August 2023)

Compile-time strings (2022-06-19; updated Overload version December 2022)

Contextual memory tracing (2022-01-26)

Notes about using IWYU on macOS (2021-07-26)

The MB confusion (2021-06-20)

Enum filter (2020-09-26)

Time zones in Python (2019-09-01)

阅读的权利 (a Chinese translation of The Right to Read) (2019-04-01)

My opinions regarding the top five TIOBE languages (2018-12-07)

25x performance boost in two hours (2018-11-22)

Pipenv and relocatable virtual environments (2018-11-04)

A VPN issue with MTU (2018-11-02)

On the use of she as a generic pronoun (2017-10-21)

A journey of purely static linking (2017-10-02)

Another Microsoft Unicode I/O problem (2017-09-29)

C/C++ performance, mmap, and string_view (2017-09-14)

Annoying Vim behaviour on Ubuntu 16.04 (2017-02-18)

Performance of my line readers (2016-11-12)

Upgrading to Boost 1.61 in MacPorts (2016-08-18)

Python yield and C++ coroutines (2016-08-16)

A small experiment of system scripting in Python (2016-07-24)

Choosing a multi-precision library for C++—a critique (2016-06-04)

MSVCRT.DLL console I/O bug (2016-05-27)

Generic lambdas and the compose function (2015-01-03)

Type deduction and my reference mistakes (2014-12-29)

Installing Clang 3.5 for Windows (2014-12-24)

A complaint of ODF’s Asian language support (2014-12-18)

Y combinator and C++ (2014-12-14)

Study notes: functional programming with C++ (2014-12-07)

Specify LANG in a UTF-8 web page! (2006-03-28)

Vim 实用技术:技巧插件定制 (Practical Vim); PDF version available (2006-03-22)

Design and implementation of a static memory pool (2005-01-11)

A cross-platform memory leak detector (2004-11-28)

Stdcall and DLL tools of MSVC and MinGW (2002-08-20)

Issues about time routines on Win32 and *NIX (2002-02-26)

A fast string implementation for STL map (2002-02-24)

MSVC and MinGW DLL interlinking FAQ (2001-12-21)

Multibyte functions in Microsoft C run-time (2001-12-16)

ASP 应用程序开发规范 (Active Server Pages programming guide) (2001-08-12)

Downloadable files

gvim91.zipupdated: my personal Win32 build of gvim.exe and vim.exe version 9.1.0764. It differs from the standard Vim executables in the following ways: 1) the file and product versions are in the form major.minor.patchlevel (not major.minor.build.patchlevel) and are consistently updated; 2) both the GUI and console versions are compiled with Perl, Python2, Python3, and Ruby support (but no Lua or MzScheme); 3) a private patch is used to make plug-ins like fencview.vim run more smoothly on Windows. Check out my GitHub Vim page on how I build Vim.

breaktext: a small program that uses libunibreak to break the lines of input text. Type ‘breaktext’ for the usage. Some usage examples (Windows): ‘breaktext input.txt output.txt’ breaks a UTF-16 text file with no explicit language info; ‘breaktext -LChinese_China.936 -lzh - < input.txt > output.txt’ breaks a Chinese text file encoded in CP936. The source code is now hosted on GitHub, and a Windows binary is provided in this download. It has been built with MSVC and statically linked, so as to enhance compatibility and avoid the broken behaviour of multi-byte characters in MSVCRT.DLL later than Windows XP. See articles about Microsoft Unicode I/O bugs above.

jhead-3.00-ccdwidth_hack.zip: a modified version of the command-line tool jhead that reports the correct ‘35mm equivalent focal length’ on resized photos from Canon digital cameras (this is a common problem for resized digital photos, if they do not contain the EXIF 2.2 tag ‘FocalLengthIn35mmFilm’. This download contains the original jhead 3.00 source, my patch, and prebuilt binaries for Mac OS X (Snow Leopard and later) and Microsoft Windows.

_vimrc or as HTML: my Vim configuration file for Windows. It is 23 KB, and is designed for Vim 7, with heavy customizations on using Chinese/Japanese/Korean together with Western European languages. It is well commented, and should serve as a good reference if you intend to customize your Vim. Notice for Vim 7 users: You need to have iconv (automatically installed by Vim 8) to set a different fileencoding from encoding, as is done in this _vimrc. Please download libiconv-win32 and extract iconv.dll to somewhere in the path or where gvim.exe is, if you do not have it already. After doing that, you should also save the original libintl.dll in the Vim directory, and replace it with intl.dll from gettext-win32 (with renaming).

tellenc: a program to detect the encoding of a text file (source and Win32 binary included). It supports ASCII, UTF-8, UTF-16, UCS-4, Latin1, Windows-1252, CP437, GB2312, GBK, Big5, SJIS, etc. It is intended to work with Vim for file encoding autodetection: first multienc.vim, and now fencview.vim. The latest source is available on GitHub, but the Windows binary will be provided here from time to time.

echofunc.vim: A Vim plug-in to echo the function declaration as in the tags file. It displays the function declaration when ‘(’ is typed, and it supports displaying the function declaration, variable definition, etc. as tooltips when Vim is compiled with +balloon_eval.

Archival purpose only

gvim82.zip: my personal Win32 build of gvim.exe and vim.exe version 8.2.5172. It differs from the standard Vim executables in the following ways: 1) the file and product versions are in the form major.minor.patchlevel (not major.minor.build.patchlevel) and are consistently updated; 2) both the GUI and console versions are compiled with Perl, Python2, Python3, and Ruby support (but no Lua, MzScheme, or Tcl); 3) a private patch is used to make plug-ins like fencview.vim run more smoothly on Windows.

gvim74.zip: my personal Win32 build of gvim.exe and vim.exe version 7.4.2367 (DirectX support introduced in 7.4.393 is compiled in the GUI version so as to support Unicode characters beyond the BMP). It differs from the standard Vim executables in the following ways: 1) the file and product versions are in the form major.minor.patchlevel (not major.minor.build.patchlevel) and are consistently updated; 2) both the GUI and console versions are compiled with Perl, Python2, Python3, Ruby, Tcl, and Lua support; 3) Ruby 2.0 is used (instead of Ruby 1.9.2); and 4) a private patch is used to make plug-ins like fencview.vim run more smoothly on Windows.

gvim64_patched.zip: my personal Win32 build of gvim.exe version 6.4.10 (with no Perl, Python, Ruby, or Tcl support) with a special patch. This is for archival purpose only, since Vim 7 has already incorporated this patch. The patch is necessary for the Vim option encoding=utf-8 to work reliably on Far East versions of Windows, since the *printf functions in the Microsoft C Runtime (MSVCRT.DLL) require the format string to be encoded as expected by the country preference specified in the Regional Options if one calls setlocale(LC_ALL, ""). It works very well for me, but Bram did not accept in into the 6.x source tree because he thought the patch was a little risky for a stable version. See also my old _vimrc.

cvsmenu.vim: the CVS integration plug-in for Vim. It supports menu and short-cut operations, and has special multi-encoding support. You can see some snapshots here: CVS Annotate, CVS Diff, CVS Log, CVS Directory Local status; and an old snapshot showing the menu.

reimp (enhanced version by José Fonseca): a tool to convert a Win32 import library (.lib) into a .a file usable with GCC for Win32 (MinGW).

CGIC 1.07 (fixed for Win32): CGI programming library in C by Thomas Boutell.

ASP samples file: accompanying the Active Server Pages programming guide.

Useful links

Free Culture: a must-read for everybody who cares about freedom in more than software

C++ reference: my main reference of C++ now

Standard C++: news, status, and discussion about Standard C++

C++ core guidelines: in order to write good C++, we need more than the grammar

Draft C++23 standard: the final working draft of the C++23 Standard

Draft C++20 standard: the final working draft of the C++20 Standard

Draft C++17 standard: the pre-approval C++17 Standard

Draft C++14 standard: the committee draft of the C++14 Standard

Draft C++11 standard: the working draft closest to the C++11 Standard

Bjarne Stroustrup’s C++ page: every C++ programmer should read the page from the designer and original implementor of C++ (the papers are especially recommended)

Andrei Alexandrescu: author of Modern C++ Design and pioneer in policy-based design (the free chapters and the articles are highly recommended)

Eric Niebler: author of the Ranges TS and the Range v3 library

Functional Programming in C++ by Ivan Čukić: I am appreciating functional programming more and more, and there is the book on this topic, to which I happened to contribute a bit

Software optimization resources by Agner Fog: excellent resources for optimizations, including but not limited to C++

Boost C++ libraries: free peer-reviewed portable C++ source libraries that are candidates for the future C++ Standard

Clang: currently my favourite C++ compiler. It is part of LLVM, and there are many useful related software projects, such as clang-format, clang-tidy, clangd, YouCompleteMe, rtags, and vim-rtags.

GCC: the prosperity of Open Source software depends upon this Open Source C/C++/Fortran/Java/… compiler

WinLibs build: free C and C++ compiler for Microsoft Windows (the versions that use the UCRT runtime are better suited for modern Windows, since the MSVCRT runtime is pretty old and can cause surprising woes—as with some other GCC builds)

MinGW-w64 build: easy-to-use MinGW (Minimalist GNU for Windows) toolchain download for Windows (abundant choices are provided for SJLJ/DWARF/SEH and thread libraries; the SJLJ versions can target both x86 and x64)

Vim: all about this excellent Open Source editor

Cygwin: a Linux-like environment for Windows

Windows binaries of GNU Wget: the non-interactive GNU downloader. I used to use binaries from Bart Puype’s WGET for Windows page, which featured very small executables. However, that site is now gone, and Jernej Simončič is providing a build that has nice Windows integration and is much more up-to-date.

Standard Template Library Programmer’s Guide: the original STL page from SGI (via Wayback Machine—I can hardly believe that Hewlett Packard Enterprise cannot afford to keep the archive online…)

The Old New Thing: informative, and often enlightening, blog of a Microsoft insider

Butterick’s Practical Typography: a good site about typography (the author’s Equity font is used on this site)

Font Squirrel: free fonts and free webfont generator

Fira Code: Type ‘!=’, and you will get ‘!=’ with this programmers’ font (try copying this line to a text editor)—is it cool?

Dieter Steffmann @ typOasis: hundreds of free (traditional) fonts (via Wayback Machine; my title font is Dieter’s Old English Five)

About me

I am Chinese, and my full name in Chinese is 吴咏炜 (Wu Yongwei). Eastern names usually go with family name first, so my given name is ‘Yongwei’. I have been a programmer for more than 30 years, and am mostly interested in writing code that is reliable, reusable, efficient, and cross-platform. You can check out my GitHub repositories for my open-source contributions.

Last update: 2024-10-11, by Wu Yongwei
Contact: wuyongwei AT gmail DOT suffix-that-you-know