Difference between revisions of "Studio:Applying pragmas up and down type chains"
Line 25: | Line 25: | ||
typedef S* pS; <br> | typedef S* pS; <br> | ||
#pragma scl_union(S, u, discrim); <br> | #pragma scl_union(S, u, discrim); <br> | ||
− | |||
− |
Revision as of 15:08, 5 February 2008
When a type T is pragmatized, it also applies to any types that are defined in terms of T.
In the following SCL, Example 1 demonstrates when the scl_union pragma has no effect on pS, S1, or pS1. This is by design. In order for the pragma to apply, it must be structured as shown in Example 2.
Example 1
typedef struct {
enum {A,B} discrim;
union
{
int x;
float f;
} u;
} S, *pS, S1, *pS1;
#pragma scl_union(S, u, discrim);
Example 2
typedef struct {
enum {A,B} discrim;
union
{
int x;
float f;
} u;
} S;
typedef S* pS;
#pragma scl_union(S, u, discrim);