docs(wiki): 收录新规范文件到仓库根目录

This commit is contained in:
TermiNexus committed 2026-10-01 23:37:53 +08:00
1 parent 785ea3ac7f
commit 4195443244
1 file changed
+25
+25
View File
@@ -0,0 +1,25 @@
对于新的代码,我们期望采用:
单行写入尽可能多的代码,比如 f(a, b, c, d, e, \nh)(代码长,根据 PEP8 换行),期望写作f(a, b, c, d, e, h)(不换行)
原本的 T | t.CPtr 尽可能写作 T*
c.Addr 和 c.Deref 可以写作为 &a 和 *a
c.DerefAs 可以写作为 *a = b
c.Load 写作为 *a = *b
允许使用 const、volatile 描述符
对于 c.Asm,期望新版写作为 __asm__
尽可能少得使用 将 ptr 强转为 uint64 然后使用的方法
t.CInt、t.CUInt64T、t.CChar 可以写作为 int、uint64、char,诸如此类
class A(t.CEnum):...可以写为 enum A:\n\ta, b, c诸如此类
注释只讲解作用,不掺杂历史原因,除了头注释,避免超长注释的存在,尽可能使用英文注释
对于&a,明确其返回T*,因此不再需要t.CPtr对其强转
if x:\n\treturn y期望写作为 if x: return y 来减少不必要的行数
原本的
X: t.CDefine = y
优先写作为 define X = y
以及define X: T = y
避免使用 if a \
b \
c:
期望尽可能一行写完 if