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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:46:57+00:00 2026-05-13T01:46:57+00:00

Is there any disadvantage to using char for small integers in C? Are there

  • 0

Is there any disadvantage to using char for small integers in C? Are there any advantages other than the occupancy/memory benefit?

In particular, is the processor likely to cope with integer arithmetic on a char better or worse than it would on a (long/short) int?

I know this will be processor/system/compiler specific, but I’m hoping for an answer in the general case, or, at least, the general case for 32-bit Windows and Solaris, being the systems I’m currently working on. I’m also assuming that things like overflow/wraparound issues have already been dealt with.

Update: Visual Studio 6.0 doesn’t actually have stdint.h as suggested by Christoph. A little benchmarking on Windows (VS 6.0, debug build, 32-bit) with a handful of stacked loops gives int and long as providing similar performance, which is about twice as fast as char. Running the same test on Linux with gcc similarly pegs int and long as similar, and both faster than char, although the difference is less pronounced.

As a side note, I’ve not spent much time looking, but the first implementation of stdint.h for VS 6.0 I found (via Wikipedia) defines uint_fast8_t as unsigned char, despite this seeming to be slower in my tests at least. Thus, the moral of the story, as Christoph rightly suggested: always benchmark!

  • 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-13T01:46:58+00:00Added an answer on May 13, 2026 at 1:46 am

    C99 added so-called ‘fastest’ minimum-width integer types to solve this problem. For the range you’re interested in, the types would be int_fast8_t and uint_fast8_t, which can be found in stdint.h.

    Keep in mind that there might be no performance gain (the increase in memory consumption might even slow things down); as always, benchmark! Don’t optimize prematurely or solely on potentially flawed assumptions of what should work.

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

Sidebar

Related Questions

Is there any disadvantage of using URL expiring concept to protect online videos?
IIS6 http compression with ASP.NET: is there any disadvantage especially when using ajax updatepanel
Is there any disadvantage you face it when you using asp.net MVC? EDIT If
Are there any advantages or disadvantages to using multiple assignment in a statement? In
Is there any disadvantage on using shared hosting in general (of discountasp.net) for an
Is there any advantage or disadvantage to using .info domain names? They are certainly
I have seen developers using WITH(nolock) in the query, is there any disadvantage of
Is there any SEO disadvantage in using a subdomain to host a blog on
Can someone confirm that for a 32bit system: Is there any disadvantage in using
What are the advantages and disadvantages of shrinking a database? Are there any performance

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.