Skip to content

Instantly share code, notes, and snippets.

@sw17ch
Created December 14, 2012 14:29
Show Gist options
  • Save sw17ch/4285820 to your computer and use it in GitHub Desktop.
Save sw17ch/4285820 to your computer and use it in GitHub Desktop.
/* Structures */
/* NO! */
typedef struct foo foo_t;
/* YES! */
struct foo;
/* Unions */
/* NO! */
typedef union foo foo_t;
/* YES! */
union foo;
/* Enumerations */
/* NO! */
typedef enum { A, B, C } letter_t;
/* YES! */
enum letter { A, B, C };
/* typedefs */
/* YESs */
typedef unsigned int age_t;
typedef int offset_t;
typedef int count_t;
/* Yes, but only beacuse C's syntax is junk */
typedef void func_ptr (void);
/* NO is anything other than a scalar. */
/* pointers should never EVER be typedeffed for any reason at all ever */
/* yes, even function pointer typedefs. */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment