Article View: comp.std.c
Article #5010Re: Restrictions on qsort compare function?
From: Clive D.W. Feather
Date: Wed, 10 Apr 1996 23:24
Date: Wed, 10 Apr 1996 23:24
23 lines
1728 bytes
1728 bytes
In article <829068682snz@genesis.demon.co.uk>, Lawrence Kirby <fred@genesis.demon.co.uk> wrote: >"Undefined behaviour is otherwise indicated in this International Standard > by the words ``undefined behaviour'' or by the omission of any explicit > defintion of behaviour. There is no difference in emphasis among these > three; they all describe ``behaviour that is undefined.''" > >This means that code has undefined behaviour unless you can show what the >defined behaviour is according to the standard. In all of your examples >the behaviour can vary depending on the actual implementation of qsort(). >In the absense of any other limitation in the standard (such as a statement >of implementation-defined behaviour), this means the behaviour is undefined. No, this is circular logic. A library function must be inferred to do only what its specification says, and nothing else; you can't use undescribed behaviour to deduce that a specific call to that function is undefined. Otherwise you could say "and abs() might set all long variables to 0". -- Clive D.W. Feather | If you lie to the compiler, cdwf@cityscape.co.uk (work, preferred) | it will get its revenge. clive@stdc.demon.co.uk (home) | - Henry Spencer
Technical Details
Message-ID:
<Dpo6Cs.CG0@stdc.demon.co.uk>Path:
arc1-ca.pugleaf.net!stdc.demon.co.uk!cliveReferences:
<4kbl1l$74r@sam.inforamp.net> <829068682snz@genesis.demon.co.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!stdc.demon.co.uk!clive From: clive@stdc.demon.co.uk (Clive D.W. Feather) Newsgroups: comp.std.c Subject: Re: Restrictions on qsort compare function? Date: Wed, 10 Apr 1996 23:24:26 GMT Organization: Demon Internet Limited (personal account) Message-ID: <Dpo6Cs.CG0@stdc.demon.co.uk> References: <4kbl1l$74r@sam.inforamp.net> <829068682snz@genesis.demon.co.uk> Reply-To: cdwf@cityscape.co.uk X-NNTP-Posting-Host: stdc.demon.co.uk