Code Monkey home page Code Monkey logo

Comments (8)

GoogleCodeExporter avatar GoogleCodeExporter commented on September 2, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 2, 2024
So the @Cast workaround is the correct solution?

Original comment by [email protected] on 26 Oct 2011 at 12:02

from javacpp.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 2, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 2, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 2, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 2, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 2, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 2, 2024
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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.