Oracle® Solaris Studio 12.4: C ユーザーガイド

印刷ビューの終了

更新: 2014 年 12 月
 
 

5.3.1 構造体ポインタへのスカラーポインタのキャスト

次の例では、integer 型のポインタ pstruct foo 型のポインタとしてキャストされます。この例で lint -Xalias_level=weak (またはそれ以上) を指定すると、エラーが生成されます。

struct foo {
    int a;
    int b;
  };

struct foo *f;
int *p;

void main()
{
    f = (struct foo *)p; /* struct pointer cast of scalar pointer error */
}