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

  • SEARCH
  • Home
  • 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 8732729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:29:24+00:00 2026-06-13T09:29:24+00:00

I’m using the Tasking VX toolset (built on Eclipse) and have a fairly basic

  • 0

I’m using the Tasking VX toolset (built on Eclipse) and have a fairly basic but fundamental problem that I can’t get around… I’ve RTFMed and am still totally none the wiser.

Imagine the simple snippet of code:

#include <stdbool.h>

bool myFlag = false;

If I enable MISRA-C checking, I get the following:

MISRA-C rule 10.1 violation: [R] restrict the use of implicit conversions for integer types

Eclipse is set up as a C99 implementation, and as per the standard library definition, stdbool.h is defined as:

#define bool  _Bool
#define true  1
#define false 0

I’m assuming that this error is because #define false 0 and the tool is implicitly converting to bool?

Note: if I cast the assignment, then the error is removed:

 bool myFlag = (bool)false;

But (IMHO) that is masking the problem, not addressing it, and I really do not want to cast every assignment.

Tools such as LINT allow you to specify the bool type to stop these sort of false positives… I need the equivalent for Eclipse/Tasking


So my question is this:

I suspect that somewhere there is a tool option to tell TASKING that bool is the boolean type, and therefore false and true are OK to be used?

Is there?

{Please no discussions [on this thread] about the merits (or otherwise) of MISRA}

  • 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-06-13T09:29:25+00:00Added an answer on June 13, 2026 at 9:29 am

    MISRA rule 10.1 says

    (Rule 10.1) The value of an expression of integer type shall not be implicitly converting to a different underlying type if:

    a) it is not a conversion to a wider integer type of the same signedness, or

    b) the expression is complex, or

    c) the expression is not constant and is a function argument, or

    d) the expression is not constant and is a return expression

    #include <stdbool.h>
    
    bool myFlag = false;
    

    is the same as:

    _Bool myFlag = 0;
    

    0 is of type int which is a signed integer type but _Bool is an unsigned integer type.
    You are implicitly converting a value of a signed type to a value of an unsigned type and so
    you are violating a) in MISRA rule 10.1.

    Note that if you are using MISRA-C:2004 (I don’t think MISRA-C:2012 has been released), at the time of the publication only C90 was considered and _Bool is a C99 addition. As I wrote in the comments you can get rid of the warning using a cast like this:

    bool myFlag = (bool) false;
    

    This is the beauty of MISRA.

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

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a small JavaScript validation script that validates inputs based on Regex. I
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I have thousands of HTML files to process using Groovy/Java and I need to
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

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.