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

D. Hugh Redelmeier hugh at mimosa.com
Thu Feb 20 22:00:37 UTC 2020


| From: Andrew Cagney <andrew.cagney at gmail.com>

| 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.
| 
| Why?

Those are the only places that can (directly or indirectly) change a
reference count.

| > "const" generally helps a reader and a compiler understand a program
| > better.
| 
| It says don't write to these non-opaque contents.

It says: I (directly or indirectly) use the thing but don't change it.


More information about the Swan-dev mailing list