查看这个erlang文件中的代码有一个这样的函数:
socket_type_atom(16#00) -> pair;
socket_type_atom(16#01) -> pub;
socket_type_atom(16#02) -> sub;
socket_type_atom(16#03) -> req;
socket_type_atom(16#04) -> rep;
socket_type_atom(16#05) -> dealer;
socket_type_atom(16#06) -> router;
socket_type_atom(16#07) -> pull;
socket_type_atom(16#08) -> push.
Run Code Online (Sandbox Code Playgroud)
根据我对erlang整数表示法的理解,5#10表示基数为10的整数5.那么它16#00代表什么呢?
如文档中所述:
有两种类型的数字文字,整数和浮点数.除了传统的表示法,还有两种特定于Erlang的符号:
Run Code Online (Sandbox Code Playgroud)$char ASCII value or unicode code-point of the character char. base#value Integer with the base base, that must be an integer in the range 2..36. In Erlang 5.2/OTP R9B and earlier versions, the allowed range is 2..16.
所以,16#number它只是number十六进制.例如:
1> 16#10 == 16.
true
Run Code Online (Sandbox Code Playgroud)
或二进制:
2> 2#11111111.
255
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
59 次 |
| 最近记录: |