Comments (5)
from eman2.
The main problem with the Vector wrappers is not the constness mismatch, which I agree does not likely present an issue in practice, but rather the reference vs value mismatch, which is hard to believe yields a result that works in any way correctly, unless by the grace of a lucky compiler optimization.
Changing the cast to match the function does eliminate the warning, and, I expect, correct any misbehavior. But inasmuch as the vector templates appear to be used only for built-in numeric types, a bigger win might be achieved by changing the functions to match the cast -- that is, to accept arguments by value instead of by reference. I would have gone ahead and submitted the PR if I were confident which of those alternatives would be preferred.
from eman2.
from eman2.
from eman2.
I apologize. It appears that I would have saved us both some time by preparing the following demo earlier. It segfaults when I run it against a binary installation of EMAN2 v2.31 (the official 64-bit Linux build, that is, not one of my own):
from EMAN2 import Vec3f
v = new Vec3f()
# prints "Vec3f(0.00,0.00,0.00)":
print v
# causes a segfault in the official build:
v.set_value(1.0, 1.0, 1.0)
# prints garbage in those of my own builds that reach this point:
print v
The behavior of the above example shows that the typedef
s you point out and their use to interpose references to function pointers into the wrappers do not resolve the issue. I see no reason to think that they ever did. My best guess is that they were effective at disguising the problem from the contributor's compiler, so that it no longer warned, leading the contributor to suppose erroneously that the issue was in fact resolved.
The Python code in the current codebase does not exercise these particular wrappers, which mitigates the issue, and may explain why it has not been fixed. Of course, they could be unused in part because the issue has not been fixed. In any event, the issue stands as a trap for project contributors who try to use those wrappers in the future.
I will shortly submit a PR that actually does fix the problem for each of the wrapped vector classes. Although I think that the best solution would be to change the vector templates so that these particular functions accept their arguments by value (as their history shows they once did), and although my analysis of the current codebase is that doing so would have only positive effects any and everywhere within, I understand your reluctance to apply changes with broad scope. Accordingly, the PR will resolve the issue simply by fixing the wrappers to match the classes and removing the needless, otherwise-unused typedefs.
from eman2.
Related Issues (20)
- lacks a type converter from python utf string or bytes to std::string
- GPU too old HOT 4
- Questionable detection of 8-bit-packed mode from MRC headers HOT 4
- Useless code in libEM/emdata_transform.cpp
- Incorrect convolution processing under some circumstances HOT 1
- No rule to make target `/usr/lib64/libGLX.so' HOT 11
- New release supporting recent boost.python HOT 1
- Status of tomo in devel? HOT 4
- How to determine pixel width (Angstrom) when calculating FSC using e2proc3d? HOT 2
- corner cases of Transform class HOT 7
- Not defined variable in e2spt_tempmatch.py HOT 4
- e2ctf_auto in lores mode does not produce particle sets
- RuntimeError: std::exception caused by xform_align_nbest HOT 1
- libboost_python37.so.1.76.0: cannot open shared when test e2speedtest.py HOT 1
- cannot find fftw3d and fftw3f header files. HOT 13
- Dependency installation issue HOT 1
- substitution for runpar in eman2 HOT 3
- instructions to install to existing anaconda HOT 5
- Installation through conda HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eman2.