[erlang-questions] compile error with bits unit syntax

litao cheng litaocheng@REDACTED
Fri Jul 18 06:19:13 CEST 2008


hi, all.
when I read this paper: Programming Efficiently with Binaries and Bit
Strings http://www.erlang.se/euc/07/papers/1700Gustafsson.pdf, I encounter a
compile error, the code snipes is a example to parse the IS 683-PRL
protocol:

decode(<<N:5,Chans:N/bits-unit:11,_/bits>>) ->
    [Chan || <<Chan:11>> <- Chans].

the compiler says:
 bit type mismatch (unit) between 11 and 1

I read the erlang reference mannual, the bits unit default is 1, I think the
unit can be set, why this compile error occur? thank you!
my erlang emulator is  5.6.3(R12B-3).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080718/0f80fd70/attachment.htm>


More information about the erlang-questions mailing list