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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:59:33+00:00 2026-05-14T18:59:33+00:00

On my System: sizeof(long) in c++ is 4 aka 32bits sizeof(long) in c# is

  • 0

On my System:
sizeof(long) in c++ is 4 aka 32bits
sizeof(long) in c# is 8 aka 64 bits

So in my Interop method declarations I’ve been substituting c++ longs with c# int’s however I get the feeling this isn’t safe?

Why is a long the same size as an int in c++? And long long is 64bits? What’s next a long long long long??

  • 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-14T18:59:34+00:00Added an answer on May 14, 2026 at 6:59 pm

    Best thing to do assuming you have a recent C library is to include <stdint.h> and use uint64_t, int64_t, uint32_t, int32_t. This will works regardless of model of the underlying platform.

    But if you are curious, the underlying issue is that different systems use different models. On 32 bit systems, both Posix and Windows use ILP32, which means an integer, long and point are all 32 bits long.

    For 64 bits, Posix and Windows use different models.

    Posix usually uses LP64 which means 32 bit integers, 64 bit longs and 64 bit pointers.

    Windows uses LLP64 which means 32 bit integers and longs, 64 bit long longs and 64 bit pointers.

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

Sidebar

Related Questions

On my system, I get: sizeof ( int ) = 4 sizeof ( long
System.Web.Mvc has an HtmlHelper that contains a method called EditorFor that renders the editing
I have been playing around with the stack on a Ubuntu 9.04 system running
In x86/amd64 world sizeof(long long) is 8. Let me quote quite insightful 8 year
I am trying to write a socket system that is to handle extremely long
In C++, is there any benefit to using long over int? It seems that
System.err.println() in Eclipse doesn't print in red. I checked preferences > Run/Debug > console
System: rails 3.2.3 1.9.2p320 ubuntu 12.04 32 bit I am trying to split up
/System/Library/Services/ImageCaptureService.app - what is it? Evernote uses it for importing the images from scanners
System.out.println(1+2+3); System.out.println(1+2+3); output:- 33 123 First case is understood but the second case is

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.