Path: csiph.com!weretis.net!feeder8.news.weretis.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c++ Subject: Re: A string pointer to a static or dynamic string : how to free the dynamic one ? Date: Thu, 02 Feb 2023 06:43:50 -0800 Organization: A noiseless patient Spider Lines: 30 Message-ID: <867cx0dt5l.fsf@linuxsc.com> References: <61d28ae0-d30f-47f7-adc2-bdadfd20d443n@googlegroups.com> <87a62bie22.fsf@nosuchdomain.example.com> <604d1f9c-51b9-4e7d-9c69-25b235a0eb5en@googlegroups.com> <87wn5egtw8.fsf@nosuchdomain.example.com> <87zga9f0rj.fsf@nosuchdomain.example.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader01.eternal-september.org; posting-host="cd6b68a0a75b913a4435862c053909f6"; logging-data="969718"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18awGu/7loO9bXAkER580kMu1/U8wDPAAQ=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:u2pmGOB+gTDspt0030LYCt9A+BI= sha1:PMDgPDVVeSYZ2I4KWO/kPg+vlQ0= Xref: csiph.com comp.lang.c++:88957 Keith Thompson writes: > "R.Wieser" writes: > >> "Keith Thompson" wrote in message >> news:87wn5egtw8.fsf@nosuchdomain.example.com... >> >>> If I understand you correctly, the two things you're referring to >>> are the pointer *value* and an *object* of pointer type that holds >>> that value. >> >> I do not call it an object, to me its just a variable. Anything >> beyond that (an object wich might contain other properties as well >> as methods) is (way) outside of my scope. > > The word "object" is not about object-oriented programming. The C > standard defines an "object" as a "region of data storage in the > execution environment, the contents of which can represent values"; > it doesn't use the term "variable". The C++ standard uses the word > "object" in the same way, though it doesn't have quite the same > formal definition. > > An "object" is just a variable, except that a variable typically has > a name. Just a quibble: C does have some objects that are not variables in the usual sense of the word. Generally it is true that all "variables" correspond to objects (sometimes instantiated more than once), but not all objects correspond to variables (again in the usual sense of how the term "variable" is used).