zoukankan      html  css  js  c++  java
  • erlang二进制的难理解的地方,有点神奇

    40> <<A:16>> = <<1,2>>.
    <<1,2>>
    41> <<B:16/bits>> = <<1,2>>.
    <<1,2>>
    42> <<A:16>> = << B:16/bits>>.//-----------数值相等的两个变量相等--------------------------------------------
    <<1,2>>
    43> <<A:16>> = << A:16/bits>>.   //-----------同一变量缺少默认值单位的和带上默认值单位的不相等。--------------------------------------------
    ** exception error: bad argument
    44> <<A:16/bits>> = << A:16/bits>>.
    ** exception error: bad argument
    45> <<A:16>> = << A:16>>.          
    <<1,2>>
    46> <<B:16>> = <<B:16>>.
    ** exception error: bad argument
    47> <<B:16/bits>> = <<B:16>>.
    ** exception error: bad argument
    48> <<B:16>> = <<B:16/bits>>.
    ** exception error: no match of right hand side value <<1,2>>
    49> <<B:2/unit:8>> = <<B:16/bits>>.
    ** exception error: no match of right hand side value <<1,2>>
    50> <<C:2/unit:8>> = <<B:16/bits>>.
    <<1,2>>
    51> <<D:1/unit:16>> = <<B:16/bits>>.
    <<1,2>>

    51> <<Length:32/big-unsigned-integer,OneInt:1/big-unsigned-integer-unit:32,StrLength:16,Left/binary>> = Bin.

    52>    <<"aa","bb">>.
    <<"aabb">>
    53> <<"aa",Left/binary>> = <<"aa123">>.
    <<"aa123">>

     
  • 相关阅读:
    Windows phone 7 OpenSource Project
    编程之美阅读笔记
    Java多线程中读写不一致问题
    pytorch性能瓶颈检查
    贪心会议安排
    网络编程之libevent
    笔记:自动求导【动手学深度学习v2】
    测试
    AnimeGAN+Flask部署过程
    手写哈希表
  • 原文地址:https://www.cnblogs.com/ribavnu/p/3202160.html
Copyright © 2011-2022 走看看