public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
* C standard compliance?
@ 2014-01-29 20:33 David Kastrup
  2014-01-29 20:42 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: David Kastrup @ 2014-01-29 20:33 UTC (permalink / raw)
  To: git


Hi, I am wondering if I may compare pointers with < that have been
created using different calls of malloc.

The C standard does not allow this (inequalities are only allowed for
pointers into the same structure) to allow for some cheapskate sort of
comparison in segmented architectures.

Now of course being able to _sort_ pointers also allows to _collate_
them.  It totally does not matter just _what_ their ordering relation is
as long as it yields to a sorting function (namely obeys some basic
relations).

The question is whether this kind of undefined behavior (which almost
never is implemented in unexpected ways) is frowned upon in the Git
codebase or not.

-- 
David Kastrup

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

end of thread, other threads:[~2014-01-30  0:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-29 20:33 C standard compliance? David Kastrup
2014-01-29 20:42 ` Junio C Hamano
2014-01-29 20:52   ` David Kastrup
2014-01-29 23:00     ` Philip Oakley
2014-01-29 23:33     ` brian m. carlson
2014-01-30  0:02       ` David Kastrup

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox