自动为 enum 类型添加位运算操作符

有时候需要在 C++ 里用 enum (class) 表示 flags,进行基础的 bitwise 运算,而哪怕是支持自动到 underlying integer 转换的 traditional enum,也需要额外的 cast 才能实现,所以在需要的时候为 enum 添加位运算支持还是有一定市场的。

Read More

Monthly Read Posts in Nov 2017

The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)
CppCon 2014: Unicode in CPP

Read More

用 Wirshark 捕捉分析经过 localhost 的网络包

最近写 WinAntHttp 的时候需要用 Wireshark 捕捉并分析发往 mock server 的 http 请求。

然而因为 mock server 是直接跑在本机 localhost 上的,而在 Windows 上,发往 localhost 的网络包都不会经过网卡,所以 wireshark 基本无法捕捉。

Read More

使用项目自带的 python 编译 bililive-win

众所周知,Google 喜欢拿 python 做各种工具链,比如构建系统;然而 G 家用的又是 python 2.x,并且目测在未来一段时间内都不会做升级,因此相关的工具链环境也被锁死在了 python 2.x。

某直播姬因为用的 chromium 的框架,部分资源文件的构建就依赖 python 2.x。

Read More

一次 dump 分析的复盘

首先有主站的运营同学反馈某个用户的投稿工具一选择上传视频就崩溃,100% 重现。

要到 crash dump 之后挂上 windbg,首先用 lmvm bililive 检查一下用户使用的版本:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Image path: D:\ugc_assistant\2.0.0.1054\bililive.dll
Image name: bililive.dll
Browse all global symbols functions data
Timestamp: Fri Sep 1 17:53:54 2017 (59A92E32)
CheckSum: 00A12C47
ImageSize: 00A34000
File version: 2.0.0.1054
Product version: 2.0.0.1054
File flags: 0 (Mask 17)
File OS: 4 Unknown Win32
File type: 1.0 App
File date: 00000000.00000000
Translations: 0409.04b0
CompanyName: bilibili
ProductName: bilibili投稿工具
InternalName: bililive_dll
OriginalFilename: bililive.dll

Read More

发现一个(疑似)VS 2013 lambda 实现的 Bug

考虑如下代码段:

#include <iostream>

Read More

Monthly Read Posts in Oct 2017

Coroutines and Fibers. Why and When

所以什么时候各大语言的 coroutine 标准化工作可以结束

Read More