Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Sort char array Date: Sat, 05 Oct 2019 13:22:50 -0700 Organization: None to speak of Lines: 41 Message-ID: References: <3mRlF.745330$vW4.322977@fx24.am4> <87ftk7nwlx.fsf@bsb.me.uk> <5i3mF.952079$aI7.587046@fx22.am4> <87a7afnmiq.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="da9954598832808a4a7535ee6b7854eb"; logging-data="880"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/9QqH7NvTLETkSllpscXQB" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:/VtRNo5yno2oijFNahQQahWTogM= sha1:+Xhl2qt9KRLshi5V4A+1eNx2H8Y= Xref: csiph.com comp.lang.c:146603 Bart writes: > On 05/10/2019 18:13, Ben Bacarisse wrote: >> Bart writes: > > So now you know that none of these were conforming C compilers! Mind > > you, the fact that most compilers, by default, accept a language that is > > not entirely unlike C should, by now, hardly be news to you. > I really don't care about that aspect any more. > > I write or generate code that is C-like, I pass it through compilers > that presumably are compiling a C-like language, and the results > generally work. > > Does it matter if it is not 100%, pure, conforming C? Maybe not. > In this case I know that the pointer format for all targets of interest > (see below) is compatible between function pointers and object pointers. Any C compiler, whether fully conforming or not quite conforming, might make assumptions about your code. If you call qsort with a pointer to a function whose type is incompatible with what the standard specifies, the behavior is undefined. Do the non-conforming C compilers you use document that such code will work the way you expect it to, and will continue to do so in future releases? Even if it happens to work in your narrowly defined environment, the OP wasn't asking about how to write or generate code in your environment. No doubt you feel it's not worth the effort for you to write code that conforms to the C standard, and I accept that it's not worth it *for you*. But if you're giving advice about C to others, don't expect us to accept your laziness without criticism. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Will write code for food. void Void(void) { Void(); } /* The recursive call of the void */