Sun Studio 12: C User's Guide

5.3.2 Struct Pointer Cast of Void Pointer

In the following example, the void pointer vp, is cast as a struct pointer. With lint -Xalias_level=weak (or higher), this generates a warning.


struct foo {
    int a;
    int b;
  };

struct foo *f;
void *vp;

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