Closed halabikeren closed 7 years ago
Did you forget to enclose your Newick string in quotes?
Sent from my iPhone
On Aug 6, 2017, at 9:37 AM, halabikeren notifications@github.com wrote:
Dear Hyphy Team,
I've encountered a difficulty in passing a tree instance to a function as an argument. When I try to do as stated, I receive a segmentation fault.
To reproduce the issue, please try:
`Tree T = ((a,b),(c,d),e); test(T);
function test(T) { fprintf(stdout, "tree passed: ", T, "\n"); }`
Is there any other way to pass a tree instance as an argument to a function?
Thanks! Keren
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
Thanks for the quick response!
Indeed, the segmentation fault no longer appear when I insert the newick content into quotes, as you suggested.
As far as I understand, using a newick format with no quotes should work as well (please see the code in #576 ). I wonder why there's a difference in the behavior.
Dear Keren,
This seems to be an internal bugs, because the name of the variable you are trying to pass ('T') is the same as the name of the function argument.
Try
Tree T = ((a,b),(c,d),e);
fprintf (stdout, Type(test(T)), "\n");
function test (tree) {
fprintf(stdout, "tree passed: ", tree, "\n");
return tree;
}
Best, Sergei
Dear Hyphy Team,
I've encountered a difficulty in passing a tree instance to a function as an argument. When I try to do as stated, I receive a segmentation fault.
To reproduce the issue, please try:
`Tree T = ((a,b),(c,d),e); test(T);
function test(T) { fprintf(stdout, "tree passed: ", T, "\n"); }`
Is there any other way to pass a tree instance as an argument to a function?
Thanks! Keren