Path: csiph.com!news.mixmin.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c++ Subject: Re: A string pointer to a static or dynamic string : how to free the dynamic one ? Date: Sat, 21 Jan 2023 16:54:45 -0800 Organization: None to speak of Lines: 21 Message-ID: <87a62bie22.fsf@nosuchdomain.example.com> References: <61d28ae0-d30f-47f7-adc2-bdadfd20d443n@googlegroups.com> MIME-Version: 1.0 Content-Type: text/plain Injection-Info: reader01.eternal-september.org; posting-host="a96db803e771599752dfc0089ea20ee1"; logging-data="2966613"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18vDbVWQ7nfnE4fJFhtMDDN" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:5GZsMzOK8216/A4BIAuWRFIMjzw= sha1:D/Wml3gd4Yc0fjAv2xhbbTd0U7Y= Xref: csiph.com comp.lang.c++:88699 Malcolm McLean writes: [...] > It's a mess, and a hangover from C. C tresats string as character pointers, No, a C string is by definition "a contiguous sequence of characters terminated by and including the first null character". It is not a pointer. A *pointer to a string* is by definition "a pointer to its initial (lowest addressed) character". Most manipulation of strings in C is done via string pointers. > and doesn't give you an easy way to tell if they are allocated on the heap, on > the stack, or in read-only memory. So the C programmer has to be careful. Right. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for XCOM Labs void Void(void) { Void(); } /* The recursive call of the void */