Studio:Applying pragmas up and down type chains

From STRIDE Wiki
Revision as of 17:29, 4 February 2008 by Root (talk | contribs)
Jump to: navigation, search

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);