[erlang-bugs] Bug in Interoperability Tutorial

mail.wolfgang.keller@REDACTED mail.wolfgang.keller@REDACTED
Mon Apr 14 12:21:58 CEST 2008


Hi,
I found a bug in the Interoperability tutorial (hosted at http://www.erlang.org/doc/tutorial/part_frame.html) which - luckily - did not take a lot of time to track for me but is probably able to confuse a lot of beginners and courses malfunctions of the test program:

Let's look at chapter 5: http://www.erlang.org/doc/tutorial/erl_interface.html

In 5.2 (short before 5.3) we find the following C code:

/* snip */
if (strncmp(ERL_ATOM_PTR(fnp), "foo", 3) == 0) {
res = foo(ERL_INT_VALUE(argp));
} else if (strncmp(ERL_ATOM_PTR(fnp), "bar", 17) == 0) {
res = bar(ERL_INT_VALUE(argp));
}
/* snap */

the string "bar" is only 3 characters long - not 17. So it must be:

} else if (strncmp(ERL_ATOM_PTR(fnp), "bar", 3) == 0) {

This bug caused - of course - some malfunctions on my tests.

Yours faithfully
Wolfgang Keller

P. S.: In chapter 7 this bug doesn't seem to exist:

/* snip */
if (strncmp(ERL_ATOM_PTR(fnp), "foo", 3) == 0) {
res = foo(ERL_INT_VALUE(argp));
} else if (strncmp(ERL_ATOM_PTR(fnp), "bar", 3) == 0) {
res = bar(ERL_INT_VALUE(argp));
}
/* snap */

_____________________________________________________________________
Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
http://smartsurfer.web.de/?mc=100071&distributionid=000000000066




More information about the erlang-bugs mailing list