Klemens Nanni <[email protected]> wrote: > satosin(), sin6tosa(), etc. are convenient helpers to avoid manually > casting all over the place. > > struct sockaddr aka. sa, struct sockaddr_in6 aka. sin6, etc. are well > known abbreviations in networking code.
Your diff does not touch satosin. You are mentioning them to argue that you should add more things like that, which are very different, because they use "const". > I argue you can't get familiar with networking code without knowing what > these mean, so you remember them because they are so commonly used. > > Imho, the same can apply to *toc*(). Disagree strongly, especially because of the const. But I also disagree with the idea of wrapping a trivial piece of C into a function located in another header file Is casting in C so hard that it must be abstracted in a .h file? What is next? Do we need functions to increment variables instead of using ++? I disagree with adding more of this, and I do not believe the existance of a few past helpers from 30 years ago justifies the use of new ones, ESPECIALLY if they are adding "const". > Alternatively, we can expand usages of existing *to*() calls into plain > casts and add const where required to constify functions, but that seems > like a step backward to me as it makes code overly verbose. Your proposal is to add more. I think that is a make-work project which isn't justified. That does not mean the existing ones which you call similar need to be removed, because that would also be a pointless make-work project.
