Skip to content

Instantly share code, notes, and snippets.

@mlabbe
Created January 15, 2015 22:01
Show Gist options
  • Select an option

  • Save mlabbe/e95ff8db3a2fd6e29525 to your computer and use it in GitHub Desktop.

Select an option

Save mlabbe/e95ff8db3a2fd6e29525 to your computer and use it in GitHub Desktop.
Type safe handles
#include<stdio.h>
typedef struct { int value; } ElemType;
typedef struct { int value; } ElemType2;
int main (void )
{
ElemType a;
ElemType2 b;
a.value = 1;
b.value = 2;
//test.c:15:7: error: incompatible types when assigning to type ‘ElemType’ from type ‘ElemType2’
a = b;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment