Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Andrew Nguyen

Forceful Memory Allocation

This topic is 6072 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is it possible to do forceful memory allocation? e.g, is
  
#include <iostream>
int *a
int t
void main()
{
  a*t;  
  &t = A001D;
  t=123;
}

  
possible? Just wondering... it could help to organize variable location?

Share this post


Link to post
Share on other sites
Advertisement
What do you mean by forceful memory allocation? Your code example didn''t help me much since it doesn''t make sense . Do you mean writing to a specific place in memory? If that''s what you mean then yes it is technically possible, but it''s more likely that your application will segfault. You''d basically do it like this:
  
int *Fish = 0x12341234;
*Fish = 999;

That would try to set the memory (of sizeof(int) bytes) at 0x12341234 equal to 999. Of course, that''s going to cause your application to crash . You may also want to look at ''placement new''.

[Resist Windows XP''s Invasive Production Activation Technology!]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!