Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assign with ellipsis arguments leads to hard to find bugs #24

Open
adeguet1 opened this issue Mar 10, 2015 · 1 comment
Open

Assign with ellipsis arguments leads to hard to find bugs #24

adeguet1 opened this issue Mar 10, 2015 · 1 comment
Assignees

Comments

@adeguet1
Copy link
Collaborator

Using:

vctDoubleMat m(3,3);
m.Assign(1, 0, 0,
         0, 1, 0,
         0, 0, 1);

leads to garbage because the last arguments are stacked as ints and the va_arg macros expect doubles. Users have to specify 1.0 instead of 1. The simplest fix is to define for Assign methods to cover signatures with more parameters, maybe up to 16? A macro can be introduced for this. Based on feedback from @zchen24 and @marcinbalicki.

@adeguet1 adeguet1 self-assigned this Mar 10, 2015
@adeguet1
Copy link
Collaborator Author

One option discussed in meeting:

m.Assign(const type & element0, const type & element1 = NAN, ....) // with 16 elements

The method would check that the number of parameters that are not NAN corresponds to the number of elements in the container and then assign them. We would remove all other Assign with finite number of elements and the one with ellipsis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant