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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:35:19+00:00 2026-05-25T15:35:19+00:00

I’m writing cross-platform x86/x86-64/Itanium code oriented towards high performance and would like to avoid

  • 0

I’m writing cross-platform x86/x86-64/Itanium code oriented towards high performance and would like to avoid any unnecessary operations, including unneeded type casting.

The code I have calls a function like this:

int theResult = Function(anUInt, 10);

Obviously, the type of 10 value is not specified. And Function is defined like this:

int Function (unsigned int anUInt, int anInt)
{
    // ...
}

My assumption is that, with VC++ and GCC targeting x86 machines, the size of an integer literal is 4 bytes, so no type casting would need to be performed when assigning 10 value to anInt parameter while entering the function above (the size of an int value is 4 in almost every data model). Some may not consider it as the ultimate proof of this assumption, but sizeof(1) does return 4 in VC++ and GCC code compiled for the x86 architecture. And I suppose that, if the size of an integer literal on a 64-bit machine was say 8 bytes, the 8 bytes of 10 value would have to be converted into the 4 bytes of anInt parameter, slowing down performance if Function is called very frequently (which is the case in my program).

So would the size of an integer literal be 4 in VC++ and GCC code compiled for a 64-bit architecture, like x86-64 or Itanium, or would it be 8? In other words, what would sizeof(1) return in VC++ and GCC code targeting 64-bit machines? Any special cases for the Itanium (IA-64) architecture?

Edit: changed “untyped integer” to “integer literal”.

  • 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-25T15:35:19+00:00Added an answer on May 25, 2026 at 3:35 pm

    There is no such thing as an “untyped integer” in C++. Although you may not specify the type explicity, it does have a type, and that type can be counted upon. The Standard speaks to this:

    2.13.1 Integer Literals

    2 The type of an integer literal depends on its form, value, and suffix.
    If it is decimal and has no suffix, it has the first of these types in
    which its value can be represented: int, long int; if the value cannot
    be represented as a long int, the behavior is undefined. If it is
    octal or hexadecimal and has no suffix, it has the first of these
    types in which its value can be represented: int, unsigned int, long
    int, unsigned long int. If it is suffixed by u or U, its type is the
    first of these types in which its value can be represented: unsigned
    int, unsigned long int. If it is suffixed by l or L, its type is the
    first of these types in which its value can be represented: long int,
    unsigned long int. If it is suffixed by ul, lu, uL, Lu, Ul, lU, UL, or
    LU, its type is unsigned long int.

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

Sidebar

Related Questions

I would like to count the length of a string with PHP. The string
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I am writing an app with both english and french support. The app requests
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have some data like this: 1 2 3 4 5 9 2 6

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.