-
-
Notifications
You must be signed in to change notification settings - Fork 404
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
Misleading header file in C extension (cmontecarlo1.h) #489
Comments
sure - I would also like to know how to convert an issue to a PR. I think this issue is a good candidate. |
I haven't found any new information but it seems this feature isn't available anymore. When i am done with some implementation i'll create a PR. That seems the best approach. |
I'd ask whoever added it why they did it. It's easy to assume people made a
|
When i noticed it I tried to think of a reason and didn't find one. I moved the declaration and deleted I'm happy to hear a reason and be proven wrong. |
You should see when it was added. I think it was added as part of an effort
|
It was added by @mreinecke during the performance improvements. |
okay @mreinecke is there a reason for |
I'm curious too actually |
The reason for this curious construct was (if I remember correctly) that the function line_search() is defined (not only declared) in cmontecarlo.h, but it does not have the "static" attribute. As a consequence, if cmontecarlo.h is included by two different C files, the function line_search() turns up in each of the .o files compiled from these, and the linker will most likely complain about a function being defined twice.
I must admit that I don't remember why I went for this awkward solution. There probably was a reason, but maybe not a very good one. |
Also @yeganer we need to be sure the code compiles on both gcc and clang. In the past there were some issues with incompatibilities between the two. |
I can help with compatibility problems ... just let me know if anything turns up! |
Header files should only contain includes that are necessary for the compiler to understand the header. Includes needed by the implementation should be included by the corresponding source. With this philosophy in mind the includes in all c files were reorganized. As part of this reorganization the header `cmontecarlo1.h` was removed and it's declaration moved to `cmontecarlo.h` Resolves: tardis-sn#489
Header files should only contain includes that are necessary for the compiler to understand the header. Includes needed by the implementation should be included by the corresponding source. With this philosophy in mind the includes in all c files were reorganized. As part of this reorganization the header `cmontecarlo1.h` was removed and it's declaration moved to `cmontecarlo.h` Resolves: tardis-sn#489
For some reason there is a header file called
cmontecarlo1.h
declaring a single function ( which would produce compiler errors if the order of import incmontecarlo.c
was changed).I think this function declaration should be moved to
cmontecarlo.h
and in that process I suggest to check if there are other potential errors.I also suggest adding missing declarations from functions in
cmontecarlo.c
to it's header.The text was updated successfully, but these errors were encountered: