J
jose luis fernandez diaz
Hi,
Given the program below:
#include <iostream>
int main()
{
char s1[2];
char *ptr = s1;
cout << sizeof(void *) << " " << sizeof(unsigned long) << endl;
cout << reinterpret_cast<unsigned long*>(s1) << endl;
cout << reinterpret_cast<unsigned long*>(&s1) << endl;
cout << reinterpret_cast<unsigned long*>(ptr) << endl;
cout << reinterpret_cast<unsigned long*>(&ptr) << endl;
}
PROGRAM OUTPUT:
frato2p:/tmp>a.out
8 8
0x11fffbff8
0x11fffbff8
0x11fffbff8
0x11fffbff0
memory_address(s1) == memory_address(&s1). Why does the Standard say about this ?
Thanks,
Jose Luis.
Given the program below:
#include <iostream>
int main()
{
char s1[2];
char *ptr = s1;
cout << sizeof(void *) << " " << sizeof(unsigned long) << endl;
cout << reinterpret_cast<unsigned long*>(s1) << endl;
cout << reinterpret_cast<unsigned long*>(&s1) << endl;
cout << reinterpret_cast<unsigned long*>(ptr) << endl;
cout << reinterpret_cast<unsigned long*>(&ptr) << endl;
}
PROGRAM OUTPUT:
frato2p:/tmp>a.out
8 8
0x11fffbff8
0x11fffbff8
0x11fffbff8
0x11fffbff0
memory_address(s1) == memory_address(&s1). Why does the Standard say about this ?
Thanks,
Jose Luis.