Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Ian Collins Newsgroups: comp.lang.c Subject: Re: usecases of void foo(char **b) {} Date: Tue, 8 Nov 2016 11:12:21 +1300 Lines: 43 Message-ID: References: <871syrijhw.fsf@bsb.me.uk> <8737j7gd87.fsf@bsb.me.uk> <87twbmfzah.fsf@bsb.me.uk> <87fun6f1j4.fsf@bsb.me.uk> <877f8hgb0p.fsf@bsb.me.uk> <87eg2pedkx.fsf@bsb.me.uk> <87wpghcu23.fsf@bsb.me.uk> <877f8gx44n.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net BFsde6OdZjznDBPunUa3OQIZZ7VMc8wswbctCE8D7Nj0Rs9yaH Cancel-Lock: sha1:Rszy+oHYhfOAZD0b45VvT/QYTuY= User-Agent: Mozilla/5.0 (X11; SunOS i86pc; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 In-Reply-To: Xref: csiph.com comp.lang.c:96046 On 11/ 8/16 01:37 AM, BartC wrote: > On 07/11/2016 07:42, Ian Collins wrote: >> On 11/ 7/16 09:12 AM, BartC wrote: >>> On 06/11/2016 19:40, Richard Heathfield wrote: >>>> On 06/11/16 19:18, BartC wrote: >>> >>>> int swapints(int *a, int *b) >>> >>>> int calcsum(int *sum, int *p, size_t count) >>> >>> You don't see it as anomalous that a, b, sum and p, represent different >>> data structures, but have exactly the same type? (Having written this >>> after snipping the function bodies, I've partly forgotten what each >>> parameter is. I'm relying on the names plus guesswork, as the types are >>> no help!) >> >> I still think that you would be better off with C++! > > Me, or is that a general 'you'? > > At the minute I write in my own low-level language, but it only directly > targets x64 native code. > > For x86-32, or ARM, or to distribute any programs so that other people > can build them from source, or for a bit of extra speed, then I can > target C source code, another low-level language. So why do you keep banging on about C's warts? Everyone who works with C is (or at least should be) well aware of them and has learned to live with them. > Targeting C++ is a possibility, but I can't really make use of any of > its higher-level features as my own language doesn't have them. And > probably there will be a million more warnings to have to shut up. You could use the higher level features to define you own intermediate language that behaves the way you want it. C++ is well suited for writing domain specific languages. Even without writing your own extensions, C++ allows you to disambiguate array and pointer function parameters. -- Ian