Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: usecases of void foo(char **b) {} Date: Sat, 12 Nov 2016 14:49:47 -0800 Organization: None to speak of Lines: 36 Message-ID: References: <8f154274-4b6f-41f3-8489-c94f98e5c559@googlegroups.com> <4b008cb8-2691-4e65-b725-3acddda41eb7@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="f830fb76aec43d91603702f100a3d579"; logging-data="24495"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+AvNF1Si99a568T0p9hLjF" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:M4bA843JLwKuI6k2QxtSfVZb3AU= sha1:o1uvh31aDQMspd105VwrT/3AKHs= Xref: csiph.com comp.lang.c:96441 BartC writes: > On 12/11/2016 22:07, Ian Collins wrote: >> On 11/13/16 10:36 AM, Tim Rentsch wrote: > >>> Seen from this perspective, I think string or String is a quite >>> appropriate name, and not a misleading one. >> >> But surely even form that perspective it is misleading? I can't think >> of a language that uses reference semantics where something like >> >> String a = "abc"; >> String b = a; >> >> b[1] = 'e'; >> >> Would change both a and b. >> >> A char* does not behave like a string object. > > What string object? Such a thing doesn't exist in C, at least not with > the behaviour you seem to expect. Here a and b refer to the same string. Ok, not a string object, but an array object that contains a string. [...] > And actually your example as it is will likely crash in C for related > reasons.) True. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"