Created
January 15, 2015 22:01
-
-
Save mlabbe/e95ff8db3a2fd6e29525 to your computer and use it in GitHub Desktop.
Type safe handles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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