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

  • Home
  • SEARCH
  • 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 7947213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:22:05+00:00 2026-06-04T01:22:05+00:00

I have this implementation in C#. If I am not wrong, it is used

  • 0

I have this implementation in C#.

If I am not wrong, it is used to: offsetting the memory location indicated by allocatedObject by size number of bytes and converting the memory pointer to an Int64

short size = getSize();

IntPtr allocatedObject;

long posInMemory = allocatedObject.Offset(size).ToInt64();

How can I achieve this in C++: the position in memory of the IntPtr (void *allocatedObject;) and convert the memory pointer to an Int64.

  • 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-04T01:22:06+00:00Added an answer on June 4, 2026 at 1:22 am

    Assuming you have an int64_t type that represents a 64bits integer, you would first cast the pointer to a pointer to char (that by definition has sizeof = 1), then offset it by the size, then cast it again to a pointer to int64_t.

    static_cast< int64_t* >( static_cast< char* >( allocatedObject ) + size )
    

    That’s because you cannot do pointer arithmetics with a void pointer, as it has no size. Alternatively, you could reinterpret_cast the pointer to a std::intptr_t (an integer big enough to contain any pointer), increase it by size and then cast to pointer to int64_t.

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

Sidebar

Related Questions

Paramiko's SFTPClient apparently does not have an exists method. This is my current implementation:
I have this implementation with fusion table layers where I try to use the
In my implementation I have this: /// <inheritdoc cref=IInterface{T} this[,]/> public T this[long row,
I have this pimpl design where the implementation classes are polymorphic but the interfaces
Would you call this implementation of a multiton in objective-c 'elegant'? I have programmatically
In order to have list reordering functionality I turned to this implementation . My
Say I have this code: #import <UIKit/UIKit.h> @interface MyView : UIView @end @implementation MyView
In my code, I have something that looks like this: @implementation MyClass - (id)
I have a simple html multiline tooltip implementation: this.tooltip = function(tag) { xOffset =
I searched for an implementation of std::map runtime ordering and have found this solution:

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.