lkml.org 
[lkml]   [2019]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 5/5] Lib: sort.h: replace int size with size_t size in the swap function
On Mon, 1 Apr 2019 at 12:35:55 +0300, Andy Shevchenko wrote:
> Hmm... If (*swap)() is called recursively it means the change might increase
> stack usage on 64-bit platforms.
>
> Am I missing something?

Under what conceivable circumstance would someone write a recursive
(*swap)() function?

You're technically right, but the precondition is more fantastical
than "if the U.K.'s parliament get their shit together before the
12th", so I have a hard time worrying about it.

But you did make me think of something: the whole reason swap()
takes a size argument is for the benefit of the (no longer existing)
generic swap functions. All of the custom swap functions ignore
it.

So how about *deleting* the parameter instead? That simplifies
everything.

\
 
 \ /
  Last update: 2019-04-01 11:59    [W:0.048 / U:0.936 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site