2016-02-24 98 views
1

在此erlang file代码寻找有这样的功能:16#00是什么意思?

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. 

据我了解二郎整数符号,5#10指十进制中的整数5。那么16#00代表什么?

+0

0在基座16,即,为0x0? –

回答

7

documentation描述:

有两种类型的数字文本,整数和浮点数的。除了 传统的符号,具体有两种二郎 - 符号:

$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 

或二进制:

2> 2#11111111. 
255 
+1

哦,基地第一。 D'哦! – drozzy