Hi Mario,
2017-09-21 18:00 GMT+02:00 Mario Meissner <mr.rash....@gmail.com>:
> By flag you mean that I should indicate with that variable whether an
> intersection occurred or not?
>
What I meant was: Why has your intersection_t struct an intersect member?
You don't use it.
I wanted to use it as a surrogate for your NULL return value but what was
your reason?
> Also, should I just return it without a pointer, without allocating it on
> the heap? I assume this is what you wanted me to do because you suggested
> my function head to be:
> struct intersection_t intersection(point_t p0 ....
>
I wanted to show you your options because only when you know them you will
be able to make a well reasoned decision. And, Vasco showed you a third
one. Now, it's on you to decide (not on me).
> I thought this is not possible because it would be destroyed once the
> function call ends. But apparently it doesn't: https://
> stackoverflow.com/questions/22957175/how-does-function-
> actually-return-struct-variable-in-c
>
> The VS compiler seems to complain when I try to assign the returned struct
> to another variable though.
>
Hmm, I tested it with MSVS 2013.
Regards,
Daniel
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
BRL-CAD Developer mailing list
brlcad-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-devel