[erlang-questions] is the compiler smart enough to ...

Richard Carlsson <>
Sun Dec 25 06:00:16 CET 2011


On 2011-12-25 17:03, Zabrane Mickael wrote:
> Hi guys,
>
> Suppose this function:
> foo(Bin) ->
>    Bin.
>
> Is the compiler smart enough to inline it without telling him explicitly to do so (i.e -inline  ...)?

No, the beam compiler currently does no inlining at all by default. You 
have to specify +inline on the command line or -compile(inline) in the 
module. (Now that line number information is included in exceptions, 
inlining could perhaps be turned on by default. Previously, it could 
make error messages confusing by pointing to the function where the code 
was inlined rather than to the actual source code function.)

    /Richard



More information about the erlang-questions mailing list