This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
On Ср, Mar 27, 2019 at 09:56, Florian Weimer <fw@deneb.enyo.de> wrote:
* Konstantin Kharlamov:It matters in terms of the code as read by human: α) one would no longer wonder why "by-value" is used instead of a "by-pointer",With by-pointer, the reader has to wonder if the called function retains a pointer after the call, so it is a wash in this regard.
Sorry, what you mean by "retains"? As in, "stores into a static variable for caching purposes"? Well, first of, if a struct contains pointers, then it doesn't even matter whether it was passed by-value or by-pointer — one could get a data race either way. Second, unless the function being explicit about caching a parameter, doing that behind the curtains sounds outright wrong as it gonna lead to hard to debug bugs.
So, normally I would not assume that an arbitrary function could retain its argument.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |