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: Wed, 02 Nov 2016 12:28:13 -0700 Organization: None to speak of Lines: 49 Message-ID: References: <5a9aae7f-eb86-4c7b-bc93-142504b1d0a9@googlegroups.com> <49899127-bf04-4a84-a374-5bebfbe7f4f7@googlegroups.com> <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="55d562a779fc0ae2b1f2a983cf45db85"; logging-data="7665"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ukclPu3PbpV6mpnr6PTRy" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:KRMRxnnGBwD92V95kgrZy5goqkM= sha1:UQ526bA8YePUpTMkvI8oE8/S1iY= Xref: csiph.com comp.lang.c:95609 BartC writes: > On 02/11/2016 18:47, Keith Thompson wrote: [...] >> I reject any attempt to confuse matters by using the word "string" >> or the phrase "pointer to a string" with other meanings. > > Again it seems to be me who's trying to make things less confusing, and > you who's trying to stop me doing do. > > What proportion of C programmers actually read the C standard? And as a > minutely as the regulars here? So constantly referring to that may not > be helpful. I don't know how many C programmers read the standard. But when I quote what the standard says about strings, almost all of them are capable of understanding it and accepting it. You are a notable exception. > What I was doing was similar to: > > typedef char* string; // pointer to zero-terminated sequence I understand that that typedef is common. I dislike it, because, once again, a char* can be a pointer to a string, but it cannot be a string. > string s; // a string > string* t; // a pointer to a string or a block of strings > > That's in place of: > > char* s; > char** t; > > Which might mean the same as the above or they might not. Use of a > specific term or a specific typedef signals some intention that is not > present in a bare 'char*'. Perhaps you'd accept typedef char *string_pointer; I wouldn't use it myself (I'd just use char* and figure out from context whether it's intended to point to a string), but it's less objectionable than `typedef char* string;`. -- 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"