[CM] Possible bug in s7_values

Woody Douglass wdouglass at carnegierobotics.com
Thu Apr 21 08:39:27 PDT 2022


Bill et all,

I think i may have found a bug in s7_values. consider the following
program

```
#include "s7.h"

int main(int argc, char *argv) {
    s7_scheme *s = s7_init();
    s7_pointer l = s7_list(s, 3, s7_make_integer(s, 1),
s7_make_integer(s, 2), s7_make_integer(s, 3));
    s7_pointer v = s7_values(s, l);
    s7_pointer e = s7_eval_c_string(s, "(values 1 2 3)");
    s7_display(s, l, s7_current_error_port(s));
    s7_newline(s, s7_current_error_port(s));
    s7_display(s, v, s7_current_error_port(s));
    s7_newline(s, s7_current_error_port(s));
    s7_display(s, e, s7_current_error_port(s));
    s7_newline(s, s7_current_error_port(s));
    s7_quit(s);
}
```

this program, when run, prints the following

```
(1 2 3)
(values 1 2 3)
(1 2 3)
```

I would expect the second and third lines of the output to match, which
i think is a bug.

Also, this all begs the question -- what is the proper way to handle
functions that return multiple values in C? the documentation is sparse
on the topic, unless i missed something

Thanks as always,
Woody Douglass




More information about the Cmdist mailing list