| From: | Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com> |
|---|---|
| To: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> |
| Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Mark function arguments of type "T *" as "const T *" where possible |
| Date: | 2025-12-11 17:51:49 |
| Message-ID: | CAOYmi+=+LKvTwsPMYfLL0JE3zs=hK+BHtn6DzifeQhOe3R4NCQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Wed, Dec 10, 2025 at 11:22 PM Bertrand Drouvot
<bertranddrouvot(dot)pg(at)gmail(dot)com> wrote:
> Also, with the patch in place that would mean "think twice before changing
> from const to no const" and that could create doubts and waste of time for future
> patch authors.
Yeah, exactly.
> Let me try to focus on functions that really
> deserve the change. I could look at function names that contain "copy" or "cmp",
> functions that are used for formatting/printing and size/length calculations as
> examples.
Sure, that sounds reasonable, and I would hope that those sorts of
functions are not very high on the list of backport contention.
> Any other ideas?
Just that the most useful const additions (IMHO) are going to be
places at the top of a big hierarchy, where callers expect something
not to be modified, but the lowest levels are too far removed from
that expectation for developers to easily remember. I imagine those
cases are not going to be easy to find automatically (but that
shouldn't discourage incremental improvements that can be found that
way).
Thanks!
--Jacob
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Daniel Gustafsson | 2025-12-11 17:51:53 | Re: Serverside SNI support in libpq |
| Previous Message | Andres Freund | 2025-12-11 17:49:21 | Re: [PATCH] Fix severe performance regression with gettext 0.20+ on Windows |