Re: [PATCH 1/2] uaccess: Simplify code pattern for masked user copies

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

 



On Sun, 9 Feb 2025 10:46:03 -0800
Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:

> On Sun, 9 Feb 2025 at 10:40, Linus Torvalds
> <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> >
> > It's *really* easy to miss the "oh, that changes X" when the only
> > little tiny sign of it is that "&" character inside the argument list,
> > and then the *normal* mental model is that arguments are arguments
> > *to* the function, not returns *from* the function.  
> 
> While I'm ranting, this is just another case of "C++ really got this
> very very wrong".
> 
> C++ made pass-by-reference really easy, and removed the need for even
> that tiny marker in the caller.
> 
> So then you really can't even visually see that "oh, that call changes
> its argument", and have to just know.

Or make a habit of appending '+ 0' to every argument :-)

> 
>               Linus





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux