Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6024987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:14:11+00:00 2026-05-23T04:14:11+00:00

When using JNI to interface between Java and C, javah parses a boolean value

  • 0

When using JNI to interface between Java and C, javah parses a boolean value in Java to jBoolean in the JNI header file. When I use bool in the C file, the Visual studio compiler throws a warning that

warning C4800: ‘jboolean’ : forcing value to bool ‘true’ or ‘false’ (performance warning)

Is there any other data type that should be used? Or if bool is the only data type here, what exactly are the performance problems that I might face?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T04:14:12+00:00Added an answer on May 23, 2026 at 4:14 am

    The “performance problem” is that the cast isn’t completely free. Casting to bool essentially means forcing all non-zero values to 1, which takes a tiny bit of code, as opposed to a “free” cast like widening char to int. The “performance problem” is a few extra machine instructions. If you’re doing this a million times in a tight loop, OK, maybe you care — otherwise, no, you shouldn’t care at all. This is IMO a silly compiler warning; that small added cost is simply part of the compromise you make when using bool and the compiler shouldn’t be bothering you about it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently programming an interface between some C++ code and Java using JNI. I'm
I'm currently implementing a .NET wrapper for a Java library by using JNI to
Can I use Delphi to program to the Java Native Interface ? From reading
I am trying to create a DLL to use it with Java JNI. I
Im trying to create a simple dll file.Im following the tutorial http://java.sun.com/docs/books/jni/html/start.html when i
I want to use c/cpp functions/library in an Android application using jni. any suggestion
Java Native Interface (JNI) Java Native Interface (JNI) is one of the intersting interface
When using JNI, does the JNI binary use its own memory, or use part
I call a dll from Java using JNI. The DLL calls another thirdparty library
I'm creating Java wrappers for some C code using JNI. There are dependencies on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.