Closed ThePhD closed 2 years ago
Paper number N2827.
Let's do this. https://thephd.dev/_vendor/future_cxx/papers/C%20-%20Modern%20Bit%20Utilities.html
There's a typo in the wording (double s):
int stdc_leading_onessuc(unsigned char value);
Ones may indeed suck, but it got me thinking - why not expend one extra underscore and avoid all these super-awkward final words?
I.e.
stdc_count_zeros_uc
vs. stdc_count_zerosuc
stdc_rotate_left_ull
vs. stdc_rotate_leftull
stdc_bit_floor_us
vs. stdc_bit_floorus
etc.
It's done strictly out of trying not to be as inventive with how suffixes are done in the C standard. I'm already pushing stdc_
so I might as well ask the committee if I can add the underscore there since it looks better.
Oh my god why did I close this.
Benchmarks, implementation, latest revision:
https://thephd.dev/_vendor/future_cxx/papers/C%20-%20Modern%20Bit%20Utilities.html https://ztdidk.readthedocs.io/en/latest/benchmarks/bit.html
Is the additional underscore before the type still a possibility? I guess it missed the train for the newest publication?
We don't have the underscore before the type because it's not how other functions in the C standard do it. I also think we actually may exceed the 31-character limit for a unique function in exactly one case if we do that, but I need to count the characters again to be super sure...
From what I can tell, it wouldn't be longer than 31:
>>> raw = ["_".join([x, y, z]) for x in ["count", "first"] for y in ["leading", "trailing"] for z in ["ones", "zeros"]]
>>> full = [f"stdc_{r}_ull" for r in raw] # <- using extra underscore before type
>>> from pprint import pprint
>>> pprint({f: len(f) for f in sorted(full)})
{'stdc_count_leading_ones_ull': 27,
'stdc_count_leading_zeros_ull': 28,
'stdc_count_trailing_ones_ull': 28,
'stdc_count_trailing_zeros_ull': 29,
'stdc_first_leading_ones_ull': 27,
'stdc_first_leading_zeros_ull': 28,
'stdc_first_trailing_ones_ull': 28,
'stdc_first_trailing_zeros_ull': 29}
Ah, okay, that was only before I had changed to better names.
Still haven't asked the Committee yet, maybe I'll pop ask in a meeting or just ask during the Meeting, if they accept the paper at all.
Still haven't asked the Committee yet, maybe I'll pop ask in a meeting or just ask during the Meeting, if they accept the paper at all.
I know things are getting tight but just wanted to recall this point here. 🙃
Oh crap, you're right. I need to make this a question.
Partially delayed until C???.
New paper. No number yet. https://thephd.dev/_vendor/future_cxx/papers/C%20-%20endian.html