Skip to main content
gamedev.net
🔒 Locked

Forceful Memory Allocation

Started by Andrew Nguyen Jan 1, 2002 at 4:09 PM 0 replies 350+ views
Original Post
Andrew Nguyen
Andrew Nguyen
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?
---START GEEK CODE BLOCK---GCS/M/S dpu s:+ a---- C++ UL(+) P(++) L+(+) E--- W++ N+ o K w(--) !O !M !V PS- PE+Y+ PGP+ t 5 X-- R tv+ b+ DI+ D G e* h! r-- !x ---END GEEK CODE BLOCK---
Null and Void
Null and Void
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!]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.