When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
39 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
@dawn solar you declare c bool NAME##_get_entry(const NAME *, K, NAME##_entry_t **); and then define ```c
bool NAME##_get_entry(NAME *__hashmap, K key, NAME##_entry_t **found_entry) {
hmmmm
@dawn solar https://godbolt.org/z/zKeP1b4bn
__hashmap is a reserved identifier >:(
||consider doing something like LIBRARYNAME_DETAIL_VAR_HASHMAP||
preprocessed?
yes
how did you avoid preprocessing the includes
i just removed them
it was that easy
plus for some reason only that one identifier is getting mangled
i think hashmap_new and hashmap_delete make more sense, to be consistent with everything else
it's not consistently doing it for everything to avoid issues with macros
yes
All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use, except those identifiers which are lexically identical to keywords.
Section 7.1.3 "Reserved identifiers" Paragraph 1 C17
@dawn solar
like if you did #define i 42 that would break this
eh
*destroy
destructor was probably just chosen because destroyer would sound awkward
reserved identifiers
what did you do instead?
this can be ```c
if (has_entry) {
found_entry->val = new_val;
}
return false;
why the null checks
you don't have to do a null check for every input parameter, just document it as a precondition
the main one is seems weird with is destroy_hashmap
because it seems like that return value would be used for if something during destruction actually went wrong
like how fclose can fail for example, but it's really just a sanity check and the return value indicates if you were insane or not