nothings / stb

stb single-file public domain libraries for C/C++
https://twitter.com/nothings
Other
25.83k stars 7.66k forks source link

GCC warnings for the hmdel macro #1574

Closed Yu2erer closed 8 months ago

Yu2erer commented 8 months ago

When using "hmdel" to delete a key from a hash table, I encountered a warning with GCC version 9.4.0: "warning: right-hand operand of comma expression has no effect [-Wunused-value]."

This is my code.

hmdel(ctx->hash_map, key);

Could you please let me know if I have used the code incorrectly?

nothings commented 8 months ago

Because hmdel is a macro that returns a success value, it's roughly the macro equivalent to a "function return value is ignored" warning. trying casting to (void), though I dunno if that will actually fix it.

Or just disable the warning.