Subject: Re: getting ld to issue link-time warnings
To: Luke Mewburn <lm@rmit.edu.au>
From: John F. Woods <jfw@ksr.com>
List: current-users
Date: 07/13/1994 09:20:53
> How do I get ld to do this? I would like to flag a few calls like this
> (e.g, bcopy, bzero, index, rindex) that aren't really ANSI (or whatever)
> standard, and hack the code to use the appropriate
> memmove,memset,strchr,strrchr instead. It's easier to find stuff with
> link time warnings in other situations. (I want to make the code more
> portable to other systems)

Well, in this case, the most obvious way to arrange it is to make use of the
warnings that are already in ld, and to link against a library that only contains
ansi functions (assuming one is already built, my NetBSD is at home).

> PS: I think the man page for memcpy() induces Bad Karma by
> recommending that people code with bcopy() instead, since it's not
> compatible.

Agreed; there is no reason for memcpy() to be less efficient than bcopy(),
so it shouldn't recommend bcopy().  At most it should recommend memmove().

> bcopy() should be implemented with memmove, and memcpy
> should probably be implemented as non-overlapping, so people get what
> the ANSI standard asks for :) 

The Standard explicitly permits memcpy() of overlapping objects to screw up.
It is memmove() that must handle overlapping objects correctly.


------------------------------------------------------------------------------