www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/23/05:57:57

Date: Tue, 23 Sep 1997 12:56:37 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: djgpp AT delorie DOT com
Subject: Re: %d
In-Reply-To: <34268326.0@139.134.5.33>
Message-ID: <Pine.SUN.3.91.970923125558.14928C-100000@is>
MIME-Version: 1.0

On 22 Sep 1997, Herman Schoenfeld wrote:

> >In fact, altough ANSI C permits it, I'd advise against declaring *any* 
> >functions (even with constant argument lists) with shorts or floats as 
> >one of the arguments; I suggest to always use ints and doubles instead.
> 
> Why not shorts?
> 
> ie, if you wanted a memcpy routine word writes then 
> 
> void memcpy(char *to, char *from, int len)
> {
>   len /=sizeof(short);
>   char *t = (short *) to;
>   char *f = (short *) from; 
>   while(len--) {
>    *t++=*f++
>    };
> };

Unless I miss something, this is totally unrelated both to the
question asked by Brett Porter (the originator of this thread) and to
my reply.  I don't advise against *any* use of shorts, I just say that
you should IMHO avoid using shorts in function *prototypes*.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019