3 ms·
> There are performance critical paths where passing a size_t is just unnecessary You would still be able to declare your function as taking a pointer (instead
by bobbyi_settv 6y ago
> There are performance critical paths where passing a size_t is just unnecessary
You would still be able to declare your function as taking a pointer (instead of an array, which in this world would be a far pointer) if you need to
He's saying to deprecate char[] as a parameter type, not char
- WalterBright 6y agoThat's right, nothing is taken away from the user with my proposal.
- antiquark 6y agoAn existing alternative is to put an array in a struct: struct string123 { char data[123]; }; Then create functions that user pointers to these string123 structs.
- WalterBright 6y agoThat does work, except for: 1. variable length buffers 2. every other piece of code you want to interface with uses `char*`
- david2ndaccount 6y agoIf you want a pointer to a fixed size array, just use one, eg char (*data)[123]; // syntax is somewhat awkward
- mav3rick 6y agoYou can type def that
- tgb 6y agoInterestingly, I assume you meant to end your post with "pointer to char" not "char" itself, but asterix is the the italics formatting character on HN so it's italicized it. But the funny thing is that it's italicized the "reply" button (as well as an empty i-tag after "char").