Compiler warnings

Hakan Stenholm etxhste@REDACTED
Tue Jan 15 13:37:45 CET 2002

I spent last week hunting stupid io_lib:format/2 and io:format/2 related bugs in 
the AXD301 code, the bugs where very simple - there was a missmatch between the 
number of arguments specified in the formating string and the number of 
parameters supplied in the parameter list e.g. io:format("~p ~p", [1]).

The current io code generates exit signals when this ocures, which in itself is 
good, as we get to know that things are wrong, the problem is that I had to 
restart the simulated AXD301 enviroment each time I found such an error - this 
takes a lot of time, so I would like to propouse that the compiler should check 
for these kind of missmatches.
There are several advantages to this:

* the fault is caught earlier, which means it will take less time to test and
  fix the error
* its easy to get inconsistency in the format string compared to the parameter
  list if io code is updated or 'copy & paste' is done


* we should probably not issue a error but rather a warning about strange 
  looking code, othervise we would have to be able to verify things like:

  f(Args) ->
    io:format("~p ~p ~p",Args).
  Args = [1,2,3,4],

More information about the erlang-questions mailing list