[erlang-questions] surprising bit syntax

Ulf Wiger (TN/EAB) ulf.wiger@REDACTED
Tue Jul 3 12:46:17 CEST 2007


Is it just me, or is this behaviour surprising?

4> <<255>>.
<<"ÿ">>
5> <<256>>.
<<0>>
6> <<257>>.
<<1>>
7> <<257:8>>.
<<1>>
8> <<I:8/integer>> = <<999>>.          
<<"ç">>
9> I.
231

I scanned the reference manual to find a note stating that this 
is exactly what one should expect, but I couldn't find it.

Personally, I would have expected something along the lines
of badarg, which is what list_to_binary([999]) gives.

BR,
Ulf W
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20070703/c8fb69a2/attachment.htm>


More information about the erlang-questions mailing list