Differences between revisions 32 and 33
Revision 32 as of 2009-09-10 12:05:29
Size: 3209
Editor: ?DamyanIvanov
Comment: alpha char is signed
Revision 33 as of 2009-09-10 12:07:05
Size: 3209
Editor: ?DamyanIvanov
Comment: s390 char is unsigned
Deletions are marked like this. Additions are marked like this.
Line 16: Line 16:
||char signedness || s || s || u || u || s || s || s || s || s || s || u || ? || s || ||char signedness || s || s || u || u || s || s || s || s || s || s || u || u || s ||

This page is a draft. Please help enhancing it by adding lines and filling tables. Comments at the bottom of the text are also welcome.

This is just a quick array to recall some of the specifics of the architectures found in the Debian project.

feature

alpha

amd64, kfreebsd-amd64

arm

armel

hppa

i386, kfreebsd-i386, hurd-i386

ia64

m68k

mips

mipsel

powerpc

s390

sparc

size of short

2

2

2

2

2

2

2

2

2

2

2

2

2

size of int

4

4

4

4

4

4

4

4

4

4

4

4

4

size of long

8

8

4

4

4

4

8

4

4

4

4

4

4

size of long long

8

8

8

8

8

8

8

8

8

8

8

8

8

size of float

4

4

4

4

4

4

4

4

4

4

4

4

4

size of double

8

8

8

8

8

8

8

8

8

8

8

8

8

size of long double

16 (8)

16

8

8

8

12

16

12

8

8

16 (8)

16 (8)

16 (8)

size of data pointer

8

8

4

4

4

4

8

4

4

4

4

4

4

max alignment

8

8

4

8

?

4 (16)

8

?

8

8

?

?

?

unaligned access OK

no

yes

yes

?

no

yes

no

yes

no

no

yes

?

no

endianness

little

little

little

little

big

little

little

big

big

little

big

big

big

char signedness

s

s

u

u

s

s

s

s

s

s

u

u

s

stack grows

down

down

down

down

up

down

down

down

down

down

down

?

down

func param location

regs

regs

regs

regs

?

stack

regs

stack

regs

regs

regs

regs

regs

func return ptr location

reg

stack

reg

reg

?

stack

reg

stack

reg

reg

reg

?

reg

page size(s)

8K

4K, 2M

4K

4K

?

4K, 2M/4M

?

4K

4K-64K

4K-64K

?

4K

?

C/C++ Preprocessor Symbols

Generally, GNU C tends to define the symbol

__arch__

A list of some common arch-specific symbols can be found on the Pre-defined Architecture Macros page.

Signedness

When programming in C, variables can be signed or unsigned.

Example:

unsigned char c;

explicit unsigned, 0 <= c <= 255

signed char c;

explicit signed, -128 <= c <= 127

char c;

implicit (un)signedness, depending on architecture

To force a signedness, either declare it explicitly or use the gcc command line option -f(un)signed-char. The gcc defaults differ only due to optimisation. Other compilers may not have this issue.

Obtaining this information via autoconf

AC_INIT(archtest, 0.1)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(float)
AC_CHECK_SIZEOF(double)
AC_CHECK_SIZEOF(long double)
AC_CHECK_SIZEOF(void*)
AC_C_BIGENDIAN()
AC_C_CHAR_UNSIGNED()