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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:44:40+00:00 2026-05-14T08:44:40+00:00

My OS is Debian, my default locale is UTF-8 and my compiler is gcc.

  • 0

My OS is Debian, my default locale is UTF-8 and my compiler is gcc. By default CHAR_BIT in limits.h is 8 which is ok for ASCII because in ASCII 1 char = 8 bits. But since I am using UTF-8, chars can be up to 32 bits which contradicts the CHAR_BIT default value of 8.

If I modify CHAR_BIT to 32 in limits.h to better suit UTF-8, what do I have to do in order for this new value to come into effect ? I guess I have to recompile gcc ? Do I have to recompile the linux kernel ? What about the default installed Debian packages, will they work ?

  • 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-14T08:44:41+00:00Added an answer on May 14, 2026 at 8:44 am

    C and C++ define char as a byte, i.e., the integer type for which sizeof returns 1. It doesn’t have to be 8 bits, but the overwhelming majority of the time, it is. IMHO, it should have been named byte. But back in 1972 when C was created, Westerners didn’t have to deal with multi-byte character encodings, so you could get away with conflating the “character” and “byte” types.

    You just have to live with the confusing terminology. Or typedef it away. But don’t edit your system header files. If you want a character type instead of a byte type, use wchar_t.

    But a UTF-8 string is made of 8-bit code units, so char will work just fine. You just have to remember the distinction between char and character. For example, don’t do this:

    void make_upper_case(char* pstr)
    {
       while (*pstr != '\0')
       {
          *pstr = toupper(*pstr);
          pstr++;
       }
    }
    

    toupper('a') works as expected, but toupper('\xC3') is a nonsensical attempt to uppercase half of a character.

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

Sidebar

Related Questions

I'm having trouble installing gcc 4.6.3 on Debian squeeze. 4.4 is currently installed but
On Debian-based distributions, there is a utility called unaccent which can be used to
There is a Debian g++-4.4 package, but it's not Ubuntu. There are too many
By default, when SSH'ing into a client I am automatically placed into /home/marco/ but
I tried default Passenger Nginx installation steps, but it couldn't succeed, I am newbie
An Apache 2.x Webserver with default configurations from the ubuntu/debian repositories will use the
I'm having a debian squeeze machine which has been changed recursively its file permissions
I'm having a sheevaplug with debian (default) installed on it. I would like to
I have installed Redmine on Debian. Also have Git with master (default) and develop
This is with Python 2.6.6 (default) on Debian Squeeze. Consider the following Python code.

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.