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
No checks for NULL values in Matrix.c and Vector.c #19
Comments
Good thinking. That will definitely save somebody from a silly mistake. Absolutely should be checked. Thank you. Should we also check for allocated, but uninitialized vectors and matrices? |
Yes, and they would be non-null. Checking whether they are initialized, would require an extra field, something like
|
You are correct.. Unless we go through each
to print
to print Do you think these changes would be worth it? It can be easily done by changing the |
Since the checks are going to be made at the beginning of each function that has pointers, I think changing We could place the check in a separate function for e.g Similar checks could be placed for checking whether its a SquareMatrix or not OR maybe checking IndexOutofBounds etc, to further separate functionality. This may not be necessary however. Last thing that I want to ask you is that we have the Matrix defined as such:
Here |
I'll keep the changes to However, I don't think the That being said, I invite you to argue this point, because one of the reasons I left the array based function set accessible instead of creating purely structure based function sets was so there would be a safe version and a fast/flexible version of each function. As for your other point, we should definitely switch over to However.. Could you think of any case where this would place a restriction on us? Perhaps it would be worth it to have different sized versions of the structure. One Would this be worth the trouble, or do you think it would just add clutter? If it would add clutter, I think it's reasonable to assume |
Yes, performance will be affected if we check for NULL in every single function. I guess we should leave them as it is. So, does that mean we should do follow in their footsteps.. I think not. Who knows what possibilities lie behind usage of such large matrices. We won't know if we don't try. |
Ah, sorry I forgot about word alignment.. You are correct, As for following in other engines footsteps, you are correct we should absolutely not. The beauty of the C programming language is the memory oriented aspects of it. I will admit, matrices larger than 4x4 (unless you are dealing with stress/strain matrices in order to facilitate finite element methods of soft body physics simulation) are very rare-- but the real beauty of allowing this is that you don't necessarily need to have one Second order newton-euler integration states that:
This must be performed for every Furthermore, in the future when I develop the I see much potential in this sort of thing. I agree However, for now it would be best to stick with |
Not very important...... or
The text was updated successfully, but these errors were encountered: