Oracle® Solaris Studio 12.4: C User's Guide

Exit Print View

Updated: March 2015
 
 

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 example 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 warning */
}