fegennari / 3DWorld

3D Procedural Game Engine Using OpenGL
GNU General Public License v3.0
1.15k stars 89 forks source link

Completion of error handling #7

Closed elfring closed 4 years ago

elfring commented 4 years ago

Would you like to add more error handling for return values from functions like the following?

fegennari commented 4 years ago

Thanks. How did you find these? Some static code analysis tool? There are 68 fclose() calls and 8 fseek() calls, none of which have their return values checked. I didn't realize it was possible for these to fail (and it's often not checked in other projects). It's too much work to update all 76 cases to print the proper error message with filename, etc. What I did was wrap these functions in checked versions that print an error and exit with code 1. If I ever see one fail I'll go back and add a better error message printout.

elfring commented 4 years ago

How did you find these?

I performed a simple source code search.

I didn't realize it was possible for these to fail …

How do you think about to improve static source code analysis also for this software?

What I did was wrap these functions in checked versions …

Thanks for your change acceptance.

fegennari commented 4 years ago

I'm not familiar with aspect-oriented software development. Based on a brief look at your linked sites, it looks like porting 3DWorld's 124K lines of code to this format requires significant effort. While it may make sense to start a new project using aspect-oriented principles, it doesn't make sense for me to switch 3DWorld at this time. I prefer to focus on the graphics, physics, AI, and procedural generation areas of my project. I'm less interested in C++ design patterns and language features. However, thank you for the suggestion.

For static source code analysis, I'm already using the built-in analysis provided by Microsoft Visual Studio 2019. This will hopefully find the most important code issues. I can try other analysis tools if I have time later. We have some good linux code analysis tools available at my work, but they're not free for use in my project at home.

elfring commented 4 years ago

I prefer to focus on …

Would you care for a nicer handling of cross-cutting concerns?

I can try other analysis tools …

How do you think about to try alternatives out like the following?

fegennari commented 4 years ago

I'll look into cppcheck, but I'm not too interested in the others. We have cppcheck installed at work and I ran it on our code base, but it only found false positives and violations in unused files. Thanks.

elfring commented 4 years ago

:crystal_ball: I am curious if your software development attention will grow around the discussed implementation details.