Bit-field declarations (section 6.7.2.1) – Altera Nios II C2H Compiler User Manual

Page 126

Advertising
background image

7–2

9.1

Altera Corporation

Nios II C2H Compiler User Guide

November 2009

Language

Escape character sequences in character constants are supported if
they are used as string literals rather than character constants.

The following declaration is supported because it employs a string
literal:

char *newline = "\n";

The following declaration is not supported because it employs a
character constant:

char newline = '\n';

Composite concatenation is not supported in initialization
statements.

The C2H Compiler does not support the initialization statement
which concatenates two strings, such as the following:

char s[] = "this" " string";

The following declaration is supported:

char s[] = "this string";

Bit-Field Declarations (Section 6.7.2.1)

Structs are supported; however, bit-field declarations used in packed
structs are not supported.

For example, the following packed struct defining a 3-bit field is not
supported:

struct my_struct

{

unsigned int tbits:3;

} ms;

ms.tbits = 0xFF;

You can use a mask of appropriate length to identify the significant bits:

struct my_struct

{

unsigned int tbits;

} ms;

ms.tbits = 0xFF & 7;

Advertising