[erlang-questions] Warning: NOT OPTIMIZED: sub binary is used or returned

Zabrane Mickael <>
Mon Aug 6 18:36:51 CEST 2012


Hi guys,

I'm communicating with linked-in driver using the following code:

control(Port, Command, Data) ->
    case port_control(Port, Command, Data) of
        <<0, Result/binary>> -> Result;                                           % <- LINE 468  handle a good case
        <<1, Error/binary>>  -> {error, binary_to_term(Error)}    %  <- LINE 469  handle error case
    end.


When compiling, I got this 02 warnings:

$ make
Recompile: src/pimco.erl
src/pimco.erl:468: Warning: NOT OPTIMIZED: sub binary is used or returned
src/pimco.erl469: Warning: NOT OPTIMIZED: sub binary used by erlang:binary_to_term/1
make[2]: Nothing to be done for `all'.

Is there a way to get rid of these warnings and avoid a full binary copies?
Hints?

N.B: my box R14B04/R15B01 on OSX/Linux.

Regards,
Zabrane




More information about the erlang-questions mailing list