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 3481974
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:30:23+00:00 2026-05-18T10:30:23+00:00

Can any one Give the example for Boolean_conversions Using reinterpret_cast<> Iam getting the execution

  • 0

Can any one Give the example for

 Boolean_conversions Using  reinterpret_cast<>

Iam getting the execution failure..Any one explain ..

Ex:

   void Boolean_Conversions()
     {
         bool b = 0;
         int *i = reinterpret_cast<int*> (&b);
  // iam expecting as *i is 0/false    ,but it is showing runtime error          
     }

Edit:
In ISO Standard
Section $5.2.10, para 1:

      "The result of the expression reinterpret_cast<T>(v) is the
  result of converting the expression v to type T. If T is a
  reference type, the result is an lvalue; otherwise, the re
  sult is an rvalue and the l-value to r-value (4.1), array
  to pointer (4.2), and function to pointer (4.3) standard c
  onversions are performed on the the expression v. Types sh
  all not be defined in a reinterpret_cast."

From this Iam trying ..I did many conversions ..like Array_to_Pointer,Function_To_Pointer,Integral/Pointer_Conversions ,etc…But i don’t know why it is failing For Boolean Conversions.

Can any one tell why it is failing ..Otherwise Tell the Boolean COnversions using reinterpret_cast.

Mostly It is Giving Run time failure in G++.CC/EDG/COdepad..etc compilers

Please Explain

  • 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-18T10:30:23+00:00Added an answer on May 18, 2026 at 10:30 am

    No, the output is not defined. Note that the conversion is undefined.

    On my machine *i = 0xcccccc00

    Note the lsb which is 00

    which corresponds to the value of the bool variable initialized with 0(false). The byte pattern in the other three bytes (assuming the size of int as 32-bits) is completely unspecified and depends on what is there in that memory/endianness etc.

    Technically, however that is an undefined behavior because we are deferencing a memory location (all of) which we did not reserve/allocate.

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

Sidebar

Related Questions

Can any one explain class X x; what actually it mean ...in the program...Please
I am trying to create a grammar which accepts any character or number or
I am using Axis2 for my webservices creation. I need to validate the received
In short, I'm utilizing C# to scientific computation and I've written a method that
The MSDN documentation says of the exitContext boolean parameter: true to exit and reacquire
I am new to dozer framework. I want to copy some objects to a
i am new to zend framework. i am trying to create a zend framework
i am trying to make facebook asynchronous non blocking thread in android. due to
my dear Friends I am new to this java ..so plz help me thank

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.