This is the mail archive of the
mailing list for the eCos project.
Re: TFTP client: const parameters where appropriate
On Fri, Sep 16, 2005 at 04:14:38PM +0100, David Vrabel wrote:
> Andrew Lunn wrote:
> > On Mon, Sep 05, 2005 at 02:22:13PM +0100, David Vrabel wrote:
> >>The attached patch makes the tftp_client_put and tftp_client_get
> >>parameters const where appropriate.
> > I went a bit further and added some more consts.
> I think you got a little carried away here...
> > + int * const err);
> I think you should have used my patch as-is. Having stuff like this in
> the API is a tad confusing as sprinkling parameters with useless (from
> the point of the caller) const's is not something normally[*] done.
In terms of the API it does little, agreed.
But for the implementation it can be useful. This is a particularly
poor case, but it does make it clear its a pointer to a single error,
not an array of errors. If the implementation was to do err++; the
compiler would complain. It might also help the compiler produce
better code since it knows the pointer is a constant.
I'm working on a project which has forced the use of lint, and its
suggesting putting const all other the place which i would not