Message from discussion
Expert-Q: (a!=b) != memcmp(&a,&b,sizeof a) ?
From: Alex_K...@scitex.com
Subject: Re: Expert-Q: (a!=b) != memcmp(&a,&b,sizeof a) ?
Date: 1999/06/28
Message-ID: <7l7qp3$fs4$1@nnrp1.deja.com>#1/1
X-Deja-AN: 494736320
References: <377738B4.97C7C3D@hls.via.at>
X-Http-Proxy: 1.0 x21.deja.com:80 (Squid/1.1.22) for client 149.115.100.3
Organization: Scitex Corporation Ltd
X-Article-Creation-Date: Mon Jun 28 12:45:25 1999 GMT
Newsgroups: comp.lang.c
X-Http-User-Agent: Mozilla/4.04 [en] (WinNT; I ;Nav)
In article <377738B4.97C7...@hls.via.at>,
Helmut Leitner <leit...@hls.via.at> wrote:
> Let's assume that a and b have the same basic data type
> (e.g. int, long, float, double ...).
>
> On many platforms it is possible to replace the
> comparisions
> a==b
> a!=b
> by
> memcmp(&a,&b,sizeof(a))==0
> memcmp(&a,&b,sizeof(a))
>
> What are the conditions that this will not yield the
> desired results?
I can think of two:
a) holes in data type representation
b) +0 and -0 for one's complement platforms
--
Regards,
Alex Krol
Disclaimer: I'm not speaking for Scitex Corporation Ltd
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.