Deutsch English Français Italiano |
<87le1ed0dl.fsf@bsb.me.uk> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.nobody.at!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse <ben@bsb.me.uk> Newsgroups: comp.lang.c Subject: Re: No warning at implicit removal of const. Was: relearning C: why does an in-place change to a char* segfault? Date: Fri, 02 Aug 2024 23:29:42 +0100 Organization: A noiseless patient Spider Lines: 33 Message-ID: <87le1ed0dl.fsf@bsb.me.uk> References: <IoGcndcJ1Zm83zb7nZ2dnZfqnPWdnZ2d@brightview.co.uk> <20240801174026.00002cda@yahoo.com> <v8gi7i$29iu1$1@dont-email.me> <slrnvaorkl.34j6.candycanearter07@candydeb.host.invalid> <87zfpvfdk4.fsf@nosuchdomain.example.com> <v8ii17$2q5p1$1@dont-email.me> <87v80ig4vt.fsf@nosuchdomain.example.com> <v8jbvj$2vat1$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Sat, 03 Aug 2024 00:29:42 +0200 (CEST) Injection-Info: dont-email.me; posting-host="415cf28f74f23eafe97e7e4af33ac9bc"; logging-data="3193261"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/G/Kgba5jXYQkqV/3xOkVY06ifO4G/mMA=" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:MkIzqL+wCRyilJ4nLuJH+UDT/wY= sha1:0Vdse+6JgPte6lTEABgpSRuBXHQ= X-BSB-Auth: 1.872d029bd2e70ebc5ebd.20240802232942BST.87le1ed0dl.fsf@bsb.me.uk Bytes: 2197 "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.