diff options
author | Jade Lovelace <lix@jade.fyi> | 2024-08-04 20:11:50 -0700 |
---|---|---|
committer | Jade Lovelace <lix@jade.fyi> | 2024-08-08 14:53:17 -0700 |
commit | a318c96851579b2a9812034c3a42f0e3fef05d9a (patch) | |
tree | 56fa7a4aee6b8ed094d23e09deee8e5b7d620f82 /src/libutil/hash.hh | |
parent | e34833c0253340f47dc0add8609eb86cf9cba19b (diff) |
util: implement charptr_cast
I don't like having so many reinterpret_cast statements that have to
actually be looked at to determine if they are UB. A huge number of the
reinterpret_cast instances in Lix are actually casting to some pointer
of some character type, which is always valid no matter the source type.
However, it is also worth looking at if it is not casting both *from* a
character type and also *to* a character type, since IMO splatting a
struct into a character array should be a very deliberate action instead
of just being about dealing with bad APIs.
So let's write a template that encapsulates this invariant so we can
not worry about the trivially safe reinterpret_cast invocations.
Change-Id: Ia4e2f1fa0c567123a96604ddadb3bdd7449660a4
Diffstat (limited to 'src/libutil/hash.hh')
0 files changed, 0 insertions, 0 deletions