3 ms·
Looks great, is there a way to shorten those MACROs, a little too verbose/lengthy for readability, it's probably just me.
by ausjke 6y ago
Looks great, is there a way to shorten those MACROs, a little too verbose/lengthy for readability, it's probably just me.
- ludocode 6y agoNot really. I originally used just a P_ prefix instead of POTTERY_ and tried to abbreviate some things (e.g. ITREE/ILIST for intrusive containers, etc.) I found it just made things ambiguous and required remembering more stuff (for example is ITREE a red-black tree or a weight-balanced tree? is it a map or a tree array?) I imagine a bunch of abbreviations would be less approachable for people that encounter it in a codebase without having seen Pottery before. Thankfully it only affects the instantiation of the template. When you use the resulting code, it's only as verbose as your name for it. You can call, say, an int vector "iv"; the type will be iv_t and functions will be iv_init(), iv_destroy(), etc. As for Pottery's internals, they're pretty verbose everywhere unfortunately. I did abbreviate a few things (like "open_hash_map" is "ohm" internally) but in the end I just decided to embrace the verbosity.