File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -339,11 +339,17 @@ typedef struct {
339339} Nob_Cmd_Opt ;
340340
341341NOBDEF bool nob_cmd_run_opt (Nob_Cmd * cmd , Nob_Cmd_Opt opt );
342+
343+ // NOTE: MSVC C++ compiler does not support compound literals (C99 feature)
344+ // Plain structures in C++ (without constructors) can be initialized with { }
345+ // This is called aggregate initialization (C++11 feature)
342346#if defined(__cplusplus )
343- #define nob_cmd_run ( cmd , ...) nob_cmd_run_opt(cmd, { __VA_ARGS__ })
347+ #define CLITERAL ( type ) type
344348#else
345- #define nob_cmd_run (cmd , ...) nob_cmd_run_opt(cmd, (Nob_Cmd_Opt) { __VA_ARGS__ })
346- #endif // _MSC_VER
349+ #define CLITERAL (type ) (type)
350+ #endif
351+
352+ #define nob_cmd_run (cmd , ...) nob_cmd_run_opt(cmd, CLITERAL(Nob_Cmd_Opt){ __VA_ARGS__ })
347353
348354// DEPRECATED:
349355//
You can’t perform that action at this time.
0 commit comments