Skip to content

Instantly share code, notes, and snippets.

@konstantinbe
Created January 19, 2012 20:25
Show Gist options
  • Save konstantinbe/1642358 to your computer and use it in GitHub Desktop.
Save konstantinbe/1642358 to your computer and use it in GitHub Desktop.
Serious C99 macro magic
#define CRString(string) (ID){.pointer = (CRPointer)(CRStringStructure[1]){{.behavior = (CRBehaviorStructure*)&CRStringClass, .retainCount = CRNaturalMax, .capacity = sizeof(string) / sizeof(CRChar), .length = sizeof(string) / sizeof(CRChar), .characters = string}}, .payload.natural = 0}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment