-
-
Notifications
You must be signed in to change notification settings - Fork 361
r3.univar: Bring r3.univar implementation closer to r.univar #5939
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
Conversation
Syncs usage between raster and raster3d implementations
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Solved conflicts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at it again, I would move the function to stats.c, no?
I tried, but a static function doesn't show up to other files. It was getting harder and I didn't feel comfortable (as I couldn't evaluate the impacts), of changing the header file or not being static. You're free to adapt this as you'd like. The function in the 2D and 3D version is either exactly the same, or almost the same. I opened both in comparison mode (with moved code detection) to see what diverged. |
I think you should move this to stats.c without the "static", and add it to globals.h. I don't see problem with that. |
And is globals.h becoming something part of the "public" api? I imagine it should be something available only for the implementation of the two files that use it. |
@petrasovaa A bit like this? It should work? |
The remaining big differences between r.univar vs r3.univar:
|
The function |
Parentheses are required with types, as in
The modals are all non-public (end up in executables only), no header files are distributed. So, in this case the
the stats.c and sort.c file are compiled with both r.univar and r3.univar. |
Thanks for the theory, I appreciate it! |
Addressed and approved by another after that?
This isn't much, but I happened to see when looking why there were some differences in the strings used between r and r3 versions of some code, that the implementations were more diverging than only what is needed for handling the third dimension.
I had the two files compared, side by side, and with moved blocks detection enabled to see.
Some parts of r3 had more understandable variable names, whilst the r version had gui section tags that I copied over to the r3 version.
There was a static function "univar_stat_with_percentiles" in r.univar that I would've like to use as is in the r3 version, but since it is "static", it doesn't work to define it in another file. Is duplicating that function the correct approach?
I've read about the
sizeof(type)
vssizeof expression
, and kinda concluded that it doesn't really matter to parenthesize an expression. I verified a sample little program on Godbolt: https://godbolt.org/z/Wc31Pboqx