bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gl_omap.h: why does the dispose function expect a CONST void*?


From: Vivien Kraus
Subject: gl_omap.h: why does the dispose function expect a CONST void*?
Date: Mon, 19 Sep 2022 20:43:18 +0200
User-agent: Evolution 3.45.3

Hello,

In gl_omap.h, the function to delete a key or a value from an omap is
declared as:

typedef void (*gl_mapkey_dispose_fn) (const void *key);
typedef void (*gl_mapvalue_dispose_fn) (const void *value);

They are always called on a value marked as const void *.

Why is it the case? I will have to call free() on them, or similar
destructors, that aren’t expected to respect the const qualifier.

I did not check for the other collection implementations, maybe they
have the same problem.

Am I expected to cast away the const and call my destructors on the key
and value?

Best regards,

Vivien



reply via email to

[Prev in Thread] Current Thread [Next in Thread]