Re: [PATCH] libtracefs: Prefer using const pointer arguments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 22 Mar 2021 18:59:42 +0200
"Yordan Karadzhov (VMware)" <y.karadz@xxxxxxxxx> wrote:

> I understand your preference to keep the flexibility of those API, 
> however generally spiking those are "getter" functions and they are not 
> supposed to modify the encapsulated object. If we allow the "getters" of 
> the API to modify the encapsulated object (tracefs_instancein this case) 
> this will be a bit of hacking stile of programing. At least for me, 
> having a firm and intuitive design of the API is more valuable than the 
> inconvenience that this reduced flexibility can potentially bring.

Is there an immediate need for this change? I.e. python complains about it,
or some other reason.

I'd like to hold off on changing this. This shouldn't break APIs, as the
code should still link fine if we decide to change it later.

I looked at various other libraries to see if they use const pointers for
"getter" functions. It's somewhat inconsistent. I'll look at more
libraries, and see how they are done. I'm more interested in keeping with
precedent here. C does some things differently that C++.

-- Steve



[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux