From 8665562784247393298
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,fea2c3a38bda88aa
X-Google-Attributes: gidf78e5,public
From: Valentin Bonnard <bonnardv@pratique.fr>
Subject: Re: memcmp source
Date: 1997/12/13
Message-ID: <3493278C.425A@pratique.fr>#1/1
X-Deja-AN: 298032183
References: <01bd073a$216f93e0$245b9b26@GMorris.dallasmfg.com>
X-Original-Date: Sun, 14 Dec 1997 01:25:55 +0100
Organization: Ecole Normale Superieure, Paris, France
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBVAwUBNJOLKEy4NqrwXLNJAQGpDQH9FFNuEvpLypNm8u6ulMxPe5unaa/EhXrA aanuL2TZnjnQpCfyjqichPVTNuXkuxKb4sFlurEhr0/Qkgf/f/bXMg== =wes1
Reply-To: bonnardv@pratique.fr
Newsgroups: comp.std.c++
Originator: austern@isolde.mti.sgi.com


Glenn Morris <gmorris@flash.net> writes:

> Can anyone tell me how memcmp() would be implemented under most systems? 
> Specifically, would it be implemented in C or assembler?  

It can be implemented portably by using unsigned char 
pointers. unsigned char is sometimes just another name 
for raw memory.

The portable implementation, however, is often innefficient. 
So it's implemented in unportable C or in assembler. It 
can also be a primitive for the compiler, which generates 
the best code inline.

A non portable implementation in C/C++ may copy longs (or 
unsigned longs), or even doubles.

-- 

Valentin Bonnard                mailto:bonnardv@pratique.fr
info about C++/a propos du C++: http://www.pratique.fr/~bonnardv/
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu 
]



