Rendered at 04:10:03 GMT+0000 (Coordinated Universal Time) with Cloudflare Workers.
seeknotfind 55 minutes ago [-]
If you're calling this across translation units, the calling convention will come with a performance penalty, but boy have we come full circle since pre-ANSI C required you to pass args as a struct. Much love - wish the language required struct and arg list to be the same thing. You can send a list of em and it'll work with algebraic data types for batching calls. The dream. CPU doesn't play nice though since structs aren't register shaped, but maybe they could be in a future calling convention.
DaiPlusPlus 44 minutes ago [-]
To me, “keyword arguments” means actual language keywords being used as arguments, like “minute” or “hour” in T-SQL’s DATEDIFF, for example: `SELECT DATEDIFF( hour, NOW(), someDateCol )`.
…but I think the author meant “named arguments”, like we have in C#, Swift, and Objective-C.
rileymat2 3 minutes ago [-]
Python calls them keyword arguments.
akoboldfrying 2 minutes ago [-]
I think the author meant "keyword arguments", like they're called in Python, and which they mentioned in the first sentence.
That's a C99 feature, designated initializer. Hardly modern. Yes it was ported to C++ relatively late, but it happened in C++20.
rwmj 25 minutes ago [-]
Don't C++ designated initializers require you to initialize in struct order? That makes them kind of annoying to use.
manwe150 57 minutes ago [-]
Wouldn’t c99 also make you name the type there (looking sort of like a cast), further straying from being just kwargs? I thought this was a c++ deduction feature for it to bind the initializer to whether method could take that list
akoboldfrying 34 minutes ago [-]
Reminds me of an idea I had years ago, for implementing "named binary operator syntax" in C++ so that stuff like the following would work:
int x = 5 <xor> 3; // x = 6
The basic trick was to notice that this is really parsed as:
But I sat on this for a while and later discovered someone else had already come up with it :-/
EDIT: Thanks commenter hawkice for fixing my XOR arithmetic!
gettingoverit 30 minutes ago [-]
Yeah, I've first seen it over 15 years ago. Usually you use operator of the same priority as you'd like, and also #define xor &xor_i& to get all that detail out of sight.
…but I think the author meant “named arguments”, like we have in C#, Swift, and Objective-C.
https://docs.python.org/3/glossary.html?hl=en-GB#term-keywor...
EDIT: Thanks commenter hawkice for fixing my XOR arithmetic!