Comments (8)
Well, primitive types are handled this way on purpose. For example, when we use
`int` in Java, this actually maps to `jint`, and `boolean` to `jboolean` (which
is a `typedef unsigned char` and gets interpreted as `int` I guess...) etc.
This works implicitly for the most part, but sometimes this fails yes, not just
for `bool`. For example, mapping `long` to `long` with MSVC generates a
"possible loss of data" warning, but automatically adding a cast to `long`
would not be a good idea on 32-bit platforms or Windows. In those cases, the
user should provide the `@Cast`... This is by design.
I find it surprising though that GCC does not generate at least a warning for
this. Maybe that should be reported to them.
But then again, maybe this perfectly valid C++ according to the standard, along
with other gems like this one:
http://stackoverflow.com/questions/4111495/why-is-there-an-implicit-type-convers
ion-from-pointers-to-bool-in-c
With C++, the fun never ends... :)
Original comment by [email protected]
on 26 Oct 2011 at 5:09
from javacpp.
So the @Cast workaround is the correct solution?
Original comment by [email protected]
on 26 Oct 2011 at 12:02
from javacpp.
Yes, that would be my assessment. The only thing I am worried about is that we
don't get a warning about it, something like a "reference to ... is ambiguous"
error we would get in Java... but in light of the above link, I guess this is
perfectly normal behavior for C++ :(
Original comment by [email protected]
on 26 Oct 2011 at 12:19
from javacpp.
Ok then. That's good enough for me.
(Is there a Wiki stuff like this could be added to?)
Original comment by [email protected]
on 26 Oct 2011 at 1:48
from javacpp.
Yes, that would be a good idea. Let me know if you would like to add content
yourself that others could refer to. I could give you access to modify the
(sort of) wiki pages on this site, thanks.
Original comment by [email protected]
on 27 Oct 2011 at 2:57
- Changed state: Done
from javacpp.
Sure. I can the the few things I have learned. It won't be anything near a full
documentation but it is a start.
Original comment by [email protected]
on 27 Oct 2011 at 6:42
from javacpp.
Great, thanks! I gave you permission to create and edit "wiki" pages, have fun!
BTW, if there are any other possible issues you are having with JavaCPP, please
let me know. I think we should make a new "release" with the fixes, thanks.
Original comment by [email protected]
on 28 Oct 2011 at 4:56
from javacpp.
I haven't run into anything else at the moment. All my use cases are working
properly.
Original comment by [email protected]
on 28 Oct 2011 at 11:51
from javacpp.
Related Issues (20)
- Feature Suggestion : New annotation to specify output library name at java file. HOT 24
- Core dupmp with callback FunctionPointer HOT 16
- SIGSEGV on android when native method returns empty string HOT 13
- Improve debugging HOT 3
- Eliminate dependency on libjvm.so when not required HOT 5
- @StdString annotation is ignored for function pointers HOT 6
- Function pointer instances of the same type overwrite each other? HOT 4
- Enhancement request: User-defined exceptions HOT 3
- Can't run facedetection example HOT 5
- Nullpointer in Loader.load() HOT 6
- Exception NoSuchMethodError in the beginning of execution on Android 2.2 HOT 2
- What's the correct way to implement enums? HOT 2
- Current snapshot immediately crashes in Windows HOT 6
- javacpp.presets does not compile on a fresh checkout HOT 5
- Can't get LegacyLibrary example to compile in Windows HOT 7
- Documentation: How to implement 'return' arguments - side effect HOT 2
- ffmpeg presets produces uncompileable parsed .java file for avdevice.h HOT 6
- byte array data (google protobuf) corrupted HOT 1
- Error running ndk-build with javaCPP generated files HOT 3
- BytePointer with nulls getting truncated 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 javacpp.