disabling compiler warnings

Gunilla Hugosson gunilla@REDACTED
Wed Apr 19 14:34:22 CEST 2000


Based on my experiences from teaching Erlang courses,
the warnings really are useful. A more experienced
programmer can turn off the warnings like Mattias indicated.

In my mind, an even better solution to the problem is to
rewrite the if.  Instead of:

 if
   Bertil>3 ->
     Arne = true;
   true ->
     Arne = false
 end

Write:
  Arne = if
           Bertil>3 ->
             true;
           true ->
             false
         end

/ Gunilla

Matthias.Lang@REDACTED wrote:
> 
> Hi,
> 
> Hal Snyder writes
> 
>     Hal> 4. The second program has perfectly legal balanced exports of
>     Hal> variables from both branches of an if structure. This leads
>     Hal> to a slew of inappropriate warnings - and I don't see any way
>     Hal> to turn them off without rebuilding the compiler. There is a
>     Hal> compiler switch to enable warning reports, on by default, but
>     Hal> no apparent way to turn it off.
> 
> I agree that the warnings in the fibsrch program (the first one)
> are rather over-zealous of the compiler, but there are slightly more
> verbose ways to code around the warnings, which save your bacon in
> other cases.
> 
> In any case, disabling the warnings doesn't require a rebuild. Just
> create a user_default.beam from source something like:
> 
>         -module(user_default).
>         -export([c/1]).
>         c(File) -> compile:file(File, []).
> 
> You can arrange for this to be loaded automatically via the .erlang file:
> 
>         code:load_abs("/home/super/mml/toys/user_default").
> 
> Read more about the .erlang and user_default file at
> 
>         http://www.erlang.org/documentation/doc/getting_started/getting_started.html#1.7
> 
> Matt



More information about the erlang-questions mailing list