cosurgi
http://janek.kozicki.pl/
Hi, I've never been on ARM could you guys paste me the output of this code?
CODE
// gcc -o sizes sizes.c
int main()
{
printf("int %d\n",sizeof(int ));
printf("float %d\n",sizeof(float ));
printf("double %d\n",sizeof(double ));
printf("unsigned int %d\n",sizeof(unsigned int ));
printf("char %d\n",sizeof(char ));
printf("unsigned char %d\n",sizeof(unsigned char ));
printf("short %d\n",sizeof(short ));
printf("long %d\n",sizeof(long ));
printf("unsigned short %d\n",sizeof(unsigned short ));
printf("unsigned long %d\n",sizeof(unsigned long ));
printf("long double %d\n",sizeof(long double ));
printf("long long %d\n",sizeof(long long ));
printf("unsigned long long %d\n",sizeof(unsigned long long));
printf("void* %d\n",sizeof(void* ));
};
or this one, in C++:
CODE
// g++ -o sizes sizes.cpp -g -pthread
#include <iostream>
#include <string>
#include <vector>
#include <boost/thread/mutex.hpp>
using namespace std;
int main()
{
cout << "Type bytes" << endl;
cout << "------------------------" << endl;
cout << "int " << sizeof(int ) << endl;
cout << "float " << sizeof(float ) << endl;
cout << "double " << sizeof(double ) << endl;
cout << "bool " << sizeof(bool ) << endl;
cout << "unsigned int " << sizeof(unsigned int ) << endl;
cout << "char " << sizeof(char ) << endl;
cout << "unsigned char " << sizeof(unsigned char ) << endl;
cout << "short " << sizeof(short ) << endl;
cout << "long " << sizeof(long ) << endl;
cout << "unsigned short " << sizeof(unsigned short ) << endl;
cout << "unsigned long " << sizeof(unsigned long ) << endl;
cout << "long double " << sizeof(long double ) << endl;
cout << "long long " << sizeof(long long ) << endl;
cout << "unsigned long long " << sizeof(unsigned long long) << endl;
cout << "void* " << sizeof(void* ) << endl;
cout << "std::string " << sizeof(std::string ) << endl;
cout << "std::vector<int> " << sizeof(std::vector<int> ) << endl;
cout << "boost::mutex " << sizeof(boost::mutex ) << endl;
};
here's the output for various architectures that I managed to get so far:
CODE
C++(32) C (64)
Type ia32 amd64 PowerPC Sparc Sparc
-------------------------------------------------------------
int 4 4 4 4 4
float 4 4 4 4 4
double 8 8 8 8 8
bool 1 1 1 1
unsigned int 4 4 4 4 4
char 1 1 1 1 1
unsigned char 1 1 1 1 1
short 2 2 2 2 2
long 4 8 4 4 8
unsigned short 2 2 2 2 2
unsigned long 4 8 4 4 8
long double 12 16 8 16 16
long long 8 8 8 8 8
unsigned long long 8 8 8 8 8
void* 4 8 4 8
std::string 4 8 4
std::vector<int> 12 24 12
boost::mutex 24 40
thanks in advance
CODE
// gcc -o sizes sizes.c
int main()
{
printf("int %d\n",sizeof(int ));
printf("float %d\n",sizeof(float ));
printf("double %d\n",sizeof(double ));
printf("unsigned int %d\n",sizeof(unsigned int ));
printf("char %d\n",sizeof(char ));
printf("unsigned char %d\n",sizeof(unsigned char ));
printf("short %d\n",sizeof(short ));
printf("long %d\n",sizeof(long ));
printf("unsigned short %d\n",sizeof(unsigned short ));
printf("unsigned long %d\n",sizeof(unsigned long ));
printf("long double %d\n",sizeof(long double ));
printf("long long %d\n",sizeof(long long ));
printf("unsigned long long %d\n",sizeof(unsigned long long));
printf("void* %d\n",sizeof(void* ));
};
or this one, in C++:
CODE
// g++ -o sizes sizes.cpp -g -pthread
#include <iostream>
#include <string>
#include <vector>
#include <boost/thread/mutex.hpp>
using namespace std;
int main()
{
cout << "Type bytes" << endl;
cout << "------------------------" << endl;
cout << "int " << sizeof(int ) << endl;
cout << "float " << sizeof(float ) << endl;
cout << "double " << sizeof(double ) << endl;
cout << "bool " << sizeof(bool ) << endl;
cout << "unsigned int " << sizeof(unsigned int ) << endl;
cout << "char " << sizeof(char ) << endl;
cout << "unsigned char " << sizeof(unsigned char ) << endl;
cout << "short " << sizeof(short ) << endl;
cout << "long " << sizeof(long ) << endl;
cout << "unsigned short " << sizeof(unsigned short ) << endl;
cout << "unsigned long " << sizeof(unsigned long ) << endl;
cout << "long double " << sizeof(long double ) << endl;
cout << "long long " << sizeof(long long ) << endl;
cout << "unsigned long long " << sizeof(unsigned long long) << endl;
cout << "void* " << sizeof(void* ) << endl;
cout << "std::string " << sizeof(std::string ) << endl;
cout << "std::vector<int> " << sizeof(std::vector<int> ) << endl;
cout << "boost::mutex " << sizeof(boost::mutex ) << endl;
};
here's the output for various architectures that I managed to get so far:
CODE
C++(32) C (64)
Type ia32 amd64 PowerPC Sparc Sparc
-------------------------------------------------------------
int 4 4 4 4 4
float 4 4 4 4 4
double 8 8 8 8 8
bool 1 1 1 1
unsigned int 4 4 4 4 4
char 1 1 1 1 1
unsigned char 1 1 1 1 1
short 2 2 2 2 2
long 4 8 4 4 8
unsigned short 2 2 2 2 2
unsigned long 4 8 4 4 8
long double 12 16 8 16 16
long long 8 8 8 8 8
unsigned long long 8 8 8 8 8
void* 4 8 4 8
std::string 4 8 4
std::vector<int> 12 24 12
boost::mutex 24 40
thanks in advance