29.12.2014 Views

RealView Compilation Tools Compiler Reference Guide - ARM ...

RealView Compilation Tools Compiler Reference Guide - ARM ...

RealView Compilation Tools Compiler Reference Guide - ARM ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

C and C++ Implementation Details<br />

• No locale is used to convert multibyte characters into the corresponding wide<br />

characters for a wide character constant. This is not relevant to the generic<br />

implementation.<br />

5.1.2 Basic data types<br />

This section describes how the basic data types are implemented in <strong>ARM</strong> C and C++.<br />

Size and alignment of basic data types<br />

Table 5-2 gives the size and natural alignment of the basic data types.<br />

Table 5-2 Size and alignment of data types<br />

Type Size in bits Natural alignment in bytes<br />

char 8 1 (byte-aligned)<br />

short 16 2 (halfword-aligned)<br />

int 32 4 (word-aligned)<br />

long 32 4 (word-aligned)<br />

long long 64 8 (doubleword-aligned)<br />

float 32 4 (word-aligned)<br />

double 64 8 (doubleword-aligned)<br />

long double 64 8 (doubleword-aligned)<br />

All pointers 32 4 (word-aligned)<br />

bool (C++ only) 8 1 (byte-aligned)<br />

_Bool (C only a )<br />

8 1 (byte-aligned)<br />

wchar_t (C++ only) 16 2 (halfword-aligned)<br />

a. stdbool.h can be used to define the bool macro in C.<br />

Type alignment varies according to the context:<br />

• Local variables are usually kept in registers, but when local variables spill onto<br />

the stack, they are always word-aligned. For example, a spilled local char variable<br />

has an alignment of 4.<br />

• The natural alignment of a packed type is 1.<br />

5-4 Copyright © 2007, 2010 <strong>ARM</strong> Limited. All rights reserved. <strong>ARM</strong> DUI 0348A<br />

Non-Confidential

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!