Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Found something cool in C11

Name: Anonymous 2014-08-06 10:58

c.h
typedef int i;
extern int shi;


c.c
#include "c.h"
#include "c.h"
#include "c.h"

int shi;

int
main (void)
{
return 0;
}


As you can see C11 allows multiple typedefs of the same type to the same type, a typedef long i; would be illegal
This avoids the need for include guards but sadly it does not work for structs, not that this is a problem

Name: Anonymous 2014-08-06 12:59

>>8
I take it back, you are right about this but the typedef thing is different, see 6.2.2:6 in C99 and 6.7:3
In C11 they add in 6.7:3 this:
except that:
— a typedef name may be redefined to denote the same type as it currently does, provided that type is not a variably modified type;

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List