Altera Nios II C2H Compiler Uživatelský manuál Strana 69

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 138
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 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)
Zobrazit stránku 68
1 2 ... 64 65 66 67 68 69 70 71 72 73 74 ... 137 138

Komentáře k této Příručce

Žádné komentáře