Poor, poor C++... cries in C
my_func(/*arg1=*/val1,/*arg2=*/val2)
And I suppose you could write a validator to make sure that this worked. Or using an anonymous structure in C99, or a named structure in C89. And of course a pointer if you care about register/stack usage etc.I'm not sure what the other options are.
my_func({.arg1 = val1, .arg2 = val2});Edit: struggling to find a source, though this GCC doc suggests it's C99 (but maybe that's only GCC?) - https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html
(Second place: differences in available GCC/clang compiler extensions between C and C++ [our software does not support Windows/MSVC], third place: differences in what casts are permitted/how they are done)
int foo(int N, char buf[N]);
which I like to use because they improve warning messages, but they are not accepted in C++.
Like this one!
https://clang.llvm.org/extra/clang-tidy/checks/bugprone/argu...
No need to write it:
https://clang.llvm.org/extra/clang-tidy/checks/bugprone/argu...
Efb