Slashes and dots in function names and prototypes?

后端 未结 4 709
迷失自我
迷失自我 2020-12-30 03:48

I\'m new to C and looking at Go\'s source tree I found this:

https://code.google.com/p/go/source/browse/src/pkg/runtime/race.c

void runtime∕race·Read         


        
4条回答
  •  -上瘾入骨i
    2020-12-30 04:15

    It appears this is not standard C, nor C99. In particular, it both gcc and clang complain about the dot, even when in C99 mode.

    This source code is compiled by the Part 9 compiler suite (in particular, ./pkg/tool/darwin_amd64/6c on OS X), which is bootstrapped by the Go build system. According to this document, bottom of page 8, Plan 9 and its compiler do not use ASCII at all, but use Unicode instead. At bottom of page 9, it it stated that any character with a sufficiently high code point is considered valid for use in an identifier name.

    There's no pre-processing magic at all - the definition of functions do not match the declaration of functions simply because those are different functions. For example, void runtime∕race·Initialize(); is an external function whose definition appears in ./src/pkg/runtime/race/race.go; likewise for void runtime∕race·MapShadow(…).

    The function which appears later, void runtime·raceinit(void), is a completely different function, which is aparant by the fact it actually calls runtime∕race·Initialize();.

提交回复
热议问题