Altera Nios II C2H Compiler Manual de usuario Pagina 69

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 138
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 68
Altera Corporation 9.1 3–29
November 2009 Nios II C2H Compiler User Guide
C-to-Hardware Mapping Reference
Consider the simple struct declaration shown in Example 3–22.
Example 3–22. Structure Declaration
struct s
{
int element_a;
int element_b;
int element_c;
} my_struct;
In this example, the expression (my_struct.c) translates to the
following:
*((int *)((void *)&my_struct + 2*sizeof(int)))
Structure Pointer Operator ->
The structure pointer operator is used to access a single member of a
structure or union via a pointer to the structure or union. The structure
pointer operator behaves similarly to the member operator, except that
the left-hand side of the operator must be a pointer.
The structure pointer operation on a struct(e.g. mystruct->a) is
equivalent to Example 3–23.
Example 3–23. Converted struct Pointer Operation
*((pointer_to_type_of_a) ((void *)mystruct + offset_of_a))
The structure pointer operation on a union (e.g. myunion->a) is
equivalent to Example 3–24.
Example 3–24. Converted union Pointer Operation
*((pointer_to_type_of_a)myunion)
Vista de pagina 68
1 2 ... 64 65 66 67 68 69 70 71 72 73 74 ... 137 138

Comentarios a estos manuales

Sin comentarios