git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* type_size_sort
@ 2005-12-06 21:19 Morten Welinder
  2005-12-06 21:38 ` type_size_sort Andreas Ericsson
  2005-12-06 21:45 ` type_size_sort Junio C Hamano
  0 siblings, 2 replies; 7+ messages in thread
From: Morten Welinder @ 2005-12-06 21:19 UTC (permalink / raw)
  To: GIT Mailing List

static int type_size_sort(const struct object_entry *a, const struct
object_entry *b)
{
...
  return a < b ? -1 : (a > b);
}

This does not look valid.  the standard says you must not depend on the
location:


       [#4] When  the  same  objects  (consisting  of  size  bytes,
       irrespective  of  their  current positions in the array) are
       passed more  than  once  to  the  comparison  function,  the
       results  shall be consistent with one another.  That is, for
       qsort they shall define a total ordering on the  array,  and
       for  bsearch  the  same object shall always compare the same
       way with the key.


M.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-12-07  3:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-06 21:19 type_size_sort Morten Welinder
2005-12-06 21:38 ` type_size_sort Andreas Ericsson
2005-12-06 21:46   ` type_size_sort Junio C Hamano
2005-12-07  0:51   ` type_size_sort Morten Welinder
2005-12-07  2:28     ` type_size_sort Junio C Hamano
2005-12-07  3:01       ` type_size_sort Morten Welinder
2005-12-06 21:45 ` type_size_sort Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).