Hi hackers,
During the [1] discussion it was suggested to constify the arguments
of ilist.c/ilist.h functions. Bharath (cc'ed) pointed out that it's
better to start a new thread in order to attract more hackers that may
be interested in this change, so I started one.
The patch is attached. Here are the reasons why we may want to do this:
"""
Const qualifiers ensure that we don't do something stupid in the function
implementation. Additionally they clarify the interface. As an example:
void
slist_delete(slist_head *head, const slist_node *node)
Here one can instantly tell that node->next is not going to be set to NULL.
Finally, const qualifiers potentially allow the compiler to do more
optimizations. This being said no benchmarking was done for this patch.
"""
Additionally Bharath pointed out that there are other pieces of code
that we may want to change in a similar fashion,
proclist.h/proclist_types.h as one example. I didn't do this yet
because I would like to know the community opinion first on whether we
should do this at all.
Thoughts?
[1]: https://www.postgresql.org/message-id/flat/CAApHDvrtVxr+FXEX0VbViCFKDGxA3tWDgw9oFewNXCJMmwLjLg@mail.gmail.com
--
Best regards,
Aleksander Alekseev