[转载] 那些 C 语言缺失的,我在 Rust 里找到了

我大概在 24 年前就爱上了 C 语言。当时,我通过一本西班牙语版的 “The C Programming Language”(第二版,作者是 Brian Kernighan 和 Dennis Ritchie,所以有时候也用 K&R 来称呼这本书)来学习 C 语言。在这之前,我用过 Turbo Pascal,它也有指针,也需要手动管理内存,而 C 语言在当时是新生事物,但十分强大。

CGO is not Go

Some people, when confronted with a problem, think “I know, I’ll use cgo.” Now they have two problems.

Golang 获取 goroutine id 完全指南

在 Golang 中,每个 goroutine 协程都有一个 goroutine id (goid),该goid没有向应用层暴露。但是,在很多场景下,开发者又希望使用 goid 作为唯一标识,将一个 goroutine 中的函数层级调用串联起来。比如,希望在一个 http handler 中将这个请求的每行日志都加上对应的 goid 以便于对这个请求处理过程进行跟踪和分析。

PHONY target

A phony target is one that is not really the name of a file; rather it is just a name for a recipe to be executed when you make an explicit request. There are two reasons to use a phony target: to avoid a conflict with a file of the same name, and to improve performance.

RaspberryPi 上手

当你花 35 美元买到一部树莓派(Raspberry Pi)计算机的时候,机器里面是没有预装操作系统(OS)的。这个时候你要自己下载一个 OS 到 SD 卡,插到树莓派上重启完成 OS 的安装。这一切看起来很简便,但你考虑过这个跟树莓派兼容的OS是哪里来的吗?