Polish API unsigned long vs. size_t for sizes/lengths #175
Labels
No labels
bug
duplicate
enhancement
feature
help wanted
improve API
invalid
needs documentation
not-planned
rtfm
stale
support
wishlist
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-libtom/libtomcrypt#175
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
As mentioned in #174 and #173 we should consider switching from
unsigned longtosize_twhen passing the length or size of something.@rofl0r said:
and @rofl0r a bit later:
i thought about this some more and i came to the conclusion that in order to keep future problems to a mininum it's probably not a good idea to make a manual typedef to size_t on platforms that currently do not provide stdint.h, because future version may actually have stdint.h and pull in the header implicitly through inclusion of another header, so the typedef will be problematical. so if you want to go that route it's preferable to have a custom type, for example ltc_size, which is typedef'd to unsigned long or size_t, depending on the platform.
To my surprise even pretty old MS compilers are able to handle
size_t.TBH I'm not aware of any platform that I used lately which doesn't have
stdint.hso I'm against introducing something likeltc_sizeor even worse some "macro-own-typedef-magic"^TM. I'd rather make it up to the integrator of the library to provide astdint.hhimself with the appropriate typedefs if there's none available ootb.btw according to
man 0p stddef.h, stddef.h is the proper header to include to get this type.mea culpa, you're right! no more typing for me today