2016-02-24 59 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