Mail Archives: djgpp/1997/09/22/12:30:28
>Relax, you will *never* get a crash with `printf' because of this.
>
>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++
};
};
whereas if you knew your buffers would %4
void memcpy(char *to, char *from, int len)
{
len /=sizeof(int);
char *t = (int *)to;
char *f = (int *)from;
while (len--) {
*t++=*f++;
};
};
- Raw text -