There's a subtlety here that you may have missed. The manual says<br><br>All other *bit string or binary* 
elements in the matching must have a size specification.<br><br>In <<A, B, C>> = <<1,2,3>>, all elements on the left hand side are by default of type integer, not bitstring or binary. Therefore sizes are assumed to be 1 byte each. <br>
<br>Your example is the same as writing<br><br><<A/integer, B/integer, C/integer>> = <<1,2,3>>.<br><br>This below, for example, would NOT work:<br><br><<A/binary,B/binary>> = <<1,2,3>>.<br>
<br>You would have to write<br><br><<A:1/binary,B/binary>> = <<1,2,3>>.<br><br>Example:<br>1> <<A/binary,B/binary>> = <<1,2,3>>.<br>* 1: a binary field without size is only allowed at the end of a binary pattern<br>
2> <<A:1/binary,B/binary>> = <<1,2,3>>.<br><<1,2,3>><br>3> A.<br><<1>><br>4> B.<br><<2,3>><br>5> <br><br>Hope this helps.<br><div class="gmail_quote">
2008/6/19 成立涛 <<a href="mailto:litaocheng@gmail.com">litaocheng@gmail.com</a>>:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">In erlang reference mannual, the Bit Syntax Expressions section, about the binary Size, the manual said:<br>
"In matching, this default value is only
valid for the very last element. All other bit string or binary 
elements in the matching must have a size specification."<br>we know the default size for integer is 8, float is 64, binary is the whole bytes.<br>for example:<br>> <<A, B, C>> = <<1, 2, 3>>.<br>

I think in this pattern match, the variables A, B, C all use the dafault Size.<br>Is it a conflict with reference manual?<br>thanks!<br>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br></blockquote></div><br>