Created
January 25, 2014 20:13
-
-
Save rismay/8622825 to your computer and use it in GitHub Desktop.
Lazy Instantiation as a C MACRO
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
//You should pick one style to use consistantly in your project | |
//Lazy Intantiation as a C Macro clearly explaining the concept | |
#define WSM_LAZY(variable, assignment) (variable = variable ?: assignment) | |
//Lazy Intantiation as a C Macro clearly explaining the language syntax used | |
#define WSM_TERNARY(variable, assignment) (variable = variable ?: assignment) | |
//Lazy Intantiation as a semi-operator w/class prefix | |
#define WSM_$(variable, assignment) (variable = variable ?: assignment) | |
//Lazy Intantiation as a C Macro clearly explaining the concept and no class prefix | |
#define _LAZY(variable, assignment) (variable = variable ?: assignment) | |
//Lazy Intantiation as a semi-operator and no class prefix (very wierd but works) | |
#define _$(variable, assignment) (variable = variable ?: assignment) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment