[Swan-dev] pluto: sprinkle const on many struct fd * parameters

Andrew Cagney andrew.cagney at gmail.com
Thu Feb 20 21:27:21 UTC 2020

On Thu, 20 Feb 2020 at 15:59, D. Hugh Redelmeier <hugh at mimosa.com> wrote:
> | From: Andrew Cagney <andrew.cagney at gmail.com>

> If one declares all possible struct fd * things const, the absence of
> const highlights where references could go wrong.


> "const" generally helps a reader and a compiler understand a program
> better.

It says don't write to these non-opaque contents.

> It is good that struct fd is an opaque type.
> One can imagine a change to fd_read which would involve modifying the
> struct fd.  At such time, the const could be removed.  Are you
> seriously contemplating a change that requires this?

I go where the code takes me.

More information about the Swan-dev mailing list