View difference between Paste ID: 8AA6WGTd and 6qHwe75N
SHOW: | | - or go back to the newest paste.
1
#include <cstdlib>
2
#include <iostream>
3
#include <string.h>
4
5
#define declare_at(type,name,address)						\
6-
		type * reference = (type *) address;				\
6+
	type & name = *( get_mem ((type*)address) )
7-
		type & name = * (reference);					\
7+
8
using namespace std;
9
10
template <typename TYPE>
11-
int main (void) {
11+
TYPE get_mem(TYPE address)
12
{
13-
	void * initialized;
13+
	TYPE result = address;
14-
	initialized = (void*) calloc (1,sizeof(int));
14+
	return result;
15-
	
15+
}
16
17
int main (void) 
18
{
19
	int initialized[1];
20
21
	declare_at (int, pepe, initialized);
22
23
	cout << "Value: " << pepe << endl;
24
25
	++pepe;
26
27
	cout << "Value: " << pepe << endl;
28
	cout << "AddressAlloced: " << initialized << endl;
29
	cout << "AddressOfPepe: " << &pepe << endl;
30
31
	return EXIT_SUCCESS;
32
}