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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:35:27+00:00 2026-06-06T02:35:27+00:00

// <windef.h> typedef int BOOL; Isn’t this a waste of memory since an int

  • 0
// <windef.h>

typedef int                 BOOL;

Isn’t this a waste of memory since an int is 32 bits?

Just in case I was wrong, I tried sending a normal bool* to a function that required BOOL* and didn’t work until I used the typedef int.

  • 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-06T02:35:30+00:00Added an answer on June 6, 2026 at 2:35 am

    Wow, slow down a little bit there. First of all, I’m pretty sure programmers have been using 4-byte ints for boolean variables since the beginning of programming on x86. (There used to be no such thing as a bool datatype). And I’d venture to guess that this same typedef is in the Windows 3.1 <Windows.h>.

    Second, you need to understand a bit more about the architecture. You have a 32-bit machine, which means that all of the CPU registers are 4-bytes or 32-bits wide. So for most memory accesses, it is more efficient to store and access 4-byte values than it is for a 1-byte value.

    If you have four 1-byte boolean variables packed into one 4-byte chunk of memory, three of those are not DWORD (4-byte) aligned. This means the CPU / memory controller actually has to do more work to get the value.

    And before you go smashing on MS for making that “wasteful” typedef. Consider this: Under the hood, most compilers (probabily) still implement the bool datatype as a 4-byte int for the same reasons I just mentioned. Try it in gcc, and take a look at the map file. I bet I am right.

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

Sidebar

Related Questions

How big (in bits ) is a Windows BOOL data type? Microsoft defines the
I hope I'm not being too long winded in this question, I just want
I have a really long winded switch case statement like this switch(x){ case a:
Long-Winded Background I'm working on parallelising some code for cardiac electrophysiology simulations. Since users
Apologies for the rather verbose and long-winded post, but this problem's been perplexing me
Just some background, sorry so long winded. I'm using the System.Data.SQLite ADO.net adapter to
How can I improve this code? What has made this long winded is the
Sorry for long winded title, this makes a lot more sense with an example.
This got a bit long-winded, so here's the quick version: Why does this cause
I had asked this question in a much more long-winded way a few days

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.