[CM] Possible bug in s7_values
Woody Douglass
wdouglass at carnegierobotics.com
Thu Apr 21 09:03:08 PDT 2022
I ended up working around my issue like this:
```
s7_pointer e = s7_eval(s,
s7_list(s, 2,
s7_make_symbol(s, "list-values"),
s7_cons(s, proc, itr)), s7_nil(s));
```
And then treating e as a list of zero or more values. this seems to
work, but i'm not sure if it's idiomatically correct.
Thanks,
Woody Douglass
On Thu, 2022-04-21 at 11:39 -0400, Woodrow Douglass wrote:
> 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