Results 1 to 2 of 2
I wrote a program
#include<iostream>
using namespace std;
int main()
{
int *p;
cout<<sizeof(int);
cout<<sizeof(long);
cout<<sizeof(p);
}
Since my processor is Intel Core2 processor it is supporting 64 bit. And ...
- 06-09-2008 #1Just Joined!
- Join Date
- Jun 2008
- Posts
- 4
How to compile program for 64 bit
I wrote a program
#include<iostream>
using namespace std;
int main()
{
int *p;
cout<<sizeof(int);
cout<<sizeof(long);
cout<<sizeof(p);
}
Since my processor is Intel Core2 processor it is supporting 64 bit. And accordingly I must get size of long int and pointer as 8 bytes. But I am getting 444.
I also tried modifying /usr/include/bits/wordsize.h in which I defined __WORDSIZE as 64. But still the program does not show correct output why? Should I download a different version of c++ compiler?
- 06-09-2008 #2
Don't modify the standard include headers, they are there as generic details - screw with them and you will end up have a potori of indeterminate errors no-one will be able to explain.
Your question relates to the way the compiler sees the integers and that is a compiler characteristic (on any system). Read the manual - that is do a "man gcc" and read from there. It will advise the option(s) you need to pass to the compiler to set the type size and when you will be able to get the correct stream size.


Reply With Quote