Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Parameter passing
// C++ chaining example: set up explicitly
OodleWorkOptions opts; // defaults
OodleWork_Run(job, &opts);
// C++ chaining: "immediate mode"
OodleWork_Run(job, OodleWorkOptions().SetPriority(OodlePriority_High));
// C version:
typedef struct {
OodleKickImmediate kickImmediate;
OodlePriority priority;
} OodleWorkOpts_data;
typedef struct OodleWorkOpts; // opaque!
OodleWorkOpts *OodleWorkOpts_Default(OodleWorkOpts_Data *storage);
OodleWorkOpts *OodleWorkOpts_FromData(OodleWorkOpts_Data *storage);
OodleWorkOpts *OodleWorkOpts_SetPriority(OodleWorkOpts *opts, OodlePriority prio);
// ...and so forth.
// Code using C-version:
OodleWorkOpts_Data opts_data;
OodleWork_Run(job, OodleWorkOpts_SetPriority(OodleWorkOpts_Default(&opts_data), OodlePriority_High));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment