Using VOID as a const
Ziggit
Using VOID as a const
Sometimes I use (comptime optional) void arguments in a function. For example: fn get_image( comptime T: ImageType, info: if (T == .animation) *const ImageInfo else void) *const Image { // if animation use info otherwise ignore. } and I call it like this for a non-animation: const img = get_image(.default, VOID); const img = get_image(.default, {}); // instead of this to be able to grep search for these kind of callsites I was thinking about a global const: pub const VOID: voi...
0 comments
No comments yet.