考虑以下源代码示例。
struct foo { short f1; short f2; int f3; } *fp; struct bar { int b1; int b2; } *bp; union moo { struct foo u_f; struct bar u_b; } u;
下面是编译器根据各种别名级别作出的假定:
如果该示例是使用 -xalias_level=weak 选项编译的,fp->f3 和 bp->b2 可互为别名。
如果该示例是使用 -xalias_level=layout 选项编译的,没有字段可互为别名。
如果该示例是使用 -xalias_level=strict 选项编译的,fp->f3 和 bp->b2 可互为别名。
如果该示例是使用 -xalias_level=std 选项编译的,没有字段可互为别名。