Sujet : Re: No warning at implicit removal of const. Was: relearning C: why does an in-place change to a char* segfault?
De : ben (at) *nospam* bsb.me.uk (Ben Bacarisse)
Groupes : comp.lang.cDate : 02. Aug 2024, 23:29:42
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <87le1ed0dl.fsf@bsb.me.uk>
References : 1 2 3 4 5 6 7 8
User-Agent : Gnus/5.13 (Gnus v5.13)
"Chris M. Thomasson" <
chris.m.thomasson.1@gmail.com> writes:
For some reason I had a sort of a habit wrt const pointers:
>
(experimental code, no ads, raw text...)
https://pastebin.com/raw/f52a443b1
>
________________________________
/* Interfaces
____________________________________________________________________*/
#include <stddef.h>
>
>
struct object_prv_vtable {
int (*fp_destroy) (void* const);
};
>
>
struct device_prv_vtable {
int (*fp_read) (void* const, void*, size_t);
int (*fp_write) (void* const, void const*, size_t);
};
Why? It seems like an arbitrary choice to const qualify some pointer
types and some pointed-to types (but never both).
;^)
Does the wink mean I should not take what you write seriously? If so,
please ignore my question.
-- Ben.