Studio:Scl struct sized: Difference between revisions
Jump to navigation
Jump to search
(→Syntax) |
No edit summary |
||
Line 2: | Line 2: | ||
The scl_struct_sized pragma is one of the [[SCL_Pragmas#Qualification|Qualification]] pragmas. 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. | The scl_struct_sized pragma is one of the [[SCL_Pragmas#Qualification|Qualification]] pragmas. 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. | ||
= STRIDE Versions = | |||
Available in STRIDE 3.0.0103 (StoneSteps Tower 3) and later versions | |||
== Syntax == | == Syntax == | ||
#pragma scl_struct_sized(type-name, max-size) | #pragma scl_struct_sized(type-name, max-size) |
Revision as of 18:07, 5 November 2008
The scl_struct_sized pragma
The scl_struct_sized pragma is one of the Qualification pragmas. 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.
STRIDE Versions
Available in STRIDE 3.0.0103 (StoneSteps Tower 3) and later versions
Syntax
#pragma scl_struct_sized(type-name, max-size)
Parameters | Type | Description |
type-name | Struct, Pointer |
Specifies a structure type (or a pointer to such type) that is to be sized (allocated bytes beyond its type definition).
The following restrictions apply:
|
max-size | Integer | Specifies the number of bytes to be allocated for the sized struct.
The following restrictions apply:
|
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_function(f)
#pragma scl_struct_sized(f.s, nSize);
Example 2
This example shows the declaration of a sized struct with a conformant array.
#define SOME_BOUND 1
typedef struct {
int nSize;
int nSomeJunk;
int ary[SOME_BOUND];
} ConformantArraySizedStruct;
extern void f(SimpleSizedStruct* s);
#pragma scl_function(f)
#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.