The new version makes nob_cmd_append call a variadic function, and checking for a sentinel value at the end of the list (char*)-1.
This makes nob_cmd_append compile when passing anything. I had a bug where I was accidently passing it a Nob_String_View and the generated command was nonsense (skill issue on my part, I know).
I don't know what's the best solution for this.
Maybe pass a (const char*){__VA_ARGS__} with its length?
in case of C++, maybe create a wrapper:
void nob__cmd_append(Nob_Cmd *cmd, const char **strs, size_t len);
#ifdef __cplusplus
template <typename... Args>
void nob__cpp_cmd_append_wrapper(Nob_Cmd *cmd, Args... strs)
{
const char* args[] = { strs... };
nob__cmd_append(cmd, args, sizeof(args) / sizeof(args[0]) );
}
#define nob_cmd_append(cmd, ...) nob__cpp_cmd_append_wrapper(cmd, __VA_ARGS__)
#else
#define nob_cmd_append(cmd, ...) nob__cmd_append( cmd, (const char*[]){__VA_ARGS__}, sizeof((const char*[]){__VA_ARGS__})/sizeof(char*))
#endif
The new version makes
nob_cmd_appendcall a variadic function, and checking for a sentinel value at the end of the list(char*)-1.This makes
nob_cmd_appendcompile when passing anything. I had a bug where I was accidently passing it aNob_String_Viewand the generated command was nonsense (skill issue on my part, I know).I don't know what's the best solution for this.
Maybe pass a
(const char*){__VA_ARGS__}with its length?in case of C++, maybe create a wrapper: