[erlang-questions] binary elements greater than 255

Matthew O'Gorman mog-lists@REDACTED
Sat Apr 26 07:39:37 CEST 2008


>
>
> >>  I know that lately computer industry decided to switch from 6-bit to
> 8-bit
> >>  bytes :), which when unsigned can hold values in range 0..255. But
> this
> >>  wasn't my question. I asked, why Erlang compiler didn't return error,
> when
> >>  you give it input like <<256>>. I think it's a bug.
> >>
> >>  Zvi
>

I hope I am not the only person but I think this is the exact right
behavior.  If you over flow a  binary  digit it rolls over, in many cases
this an intended behavior.  Now why an int isn't 4 bytes instead of 1 that
does seem a bit wrong, but not to shocking.

Mog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080426/4fb0f05a/attachment.htm>


More information about the erlang-questions mailing list