Studio:Scl struct sized

From STRIDE Wiki
Revision as of 00:30, 31 October 2008 by Chrisj (talk | contribs) (New page: = The scl_struct_sized pragma = The scl_struct_sized pragma identifies a particular struct or pointer-to-struct as a sized structure. A sized structure typically has bytes allocated past ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The scl_struct_sized pragma

The scl_struct_sized pragma identifies a particular struct or pointer-to-struct as a sized structure. A sized structure typically has bytes allocated past its type definition.

Syntax

#pragma scl_struct_sized(type-name, max-size)

Parameters Type Description
type-name Type Name of the type that contains the struct/pointer:
  • structure
  • pointer type
  • function name
max-size Integer Specifies the number of bytes for the sized struct.

Examples

Example 1

This example shows the declaration for a simple sized struct.

typedef struct {
    int nSize;
    int nSomeJunk;
    int nMoreJunk;
} SimpleSizedStruct;

extern void f(SimpleSizedStruct s);
#pragma scl_struct_sized(SimpleSizedStruct, nSize);

Example 2

This example shows the declaration for a simple sized struct using a pointer.

typedef struct {
    int nSize;
    int nSomeJunk;
    int nMoreJunk;
} SimpleSizedStruct;

extern void f(SimpleSizedStruct* s);
#pragma scl_struct_sized(f.s, nSize);

Example 2

This example shows the declaration of a sized struct containing a conformant array.

#define SOME_BOUND 0
typedef struct {
    int nSize;
    int nSomeJunk;
    int ary[SOME_BOUND];
} ConformantArraySizedStruct;

extern void f(SimpleSizedStruct* s);
#pragma scl_struct_sized(f.s, nSize);

See Also

  • For additional information on scl_string, including constraints, refer to the section on scl_struct_sized in the SCL Reference Guide.