Re: [PATCH v2 08/16] apply_ctype: reverse the order of arguments

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

 



On Mon, Dec 28, 2020 at 04:47:01PM +0000, Ramsay Jones wrote:
> 
> 
> On 26/12/2020 17:51, Luc Van Oostenryck wrote:
> > apply_ctype()'s argument order is: src, dst (so the reading
> > direction) but the assignment/memcpy() order is much more used:
> > 	dst = src;
> > 	memcpy(dst, src, n);
> > than the order here is confusing.
> > 
> > So, change its argument order to comply with the memcpy()/
> > assignement order and stop the confusion.
> 
> Hmm, how about:
> 
> """
> apply_ctype()'s argument order is 'src' then 'dst', which reads as
> copying 'src' to 'dst'. However, assignment, and many library functions
> (eg. memcpy()), use the opposite order for the source and destination
> of a copy operation.
> 
> So, change the argument order of apply_ctype() to mimic the order of
> memcpy()/assignment, to hopefully reduce any potential confusion.
> """
> 
> Heh, well that is probably not much better! ;-)

It's better but I'll try to reformulate it to better express that:
*) the 'reading direction' (left to right) vs. the 'assignment direction'
   (right to left) is a question of API choice
*) the left-to-right direction confuses *me* endlessly, but it's just me.

-- Luc



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux