Jump to page: 1 2
Thread overview
[Issue 17188] `core.stdc.stdlib.qsort()` is broken
Feb 16, 2017
Ketmar Dark
Feb 23, 2017
Walter Bright
Apr 12, 2017
Walter Bright
Oct 08, 2017
Rainer Schuetze
Oct 08, 2017
Rainer Schuetze
Dec 13, 2017
Seb
Dec 16, 2017
Rainer Schuetze
Dec 16, 2017
ZombineDev
Feb 28, 2018
Martin Nowak
[Issue 17188] stdc qsort predicate requires scope parameters
Feb 28, 2018
Martin Nowak
February 16, 2017
https://issues.dlang.org/show_bug.cgi?id=17188

Ketmar Dark <ketmar@ketmar.no-ip.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ketmar@ketmar.no-ip.org

--
February 23, 2017
https://issues.dlang.org/show_bug.cgi?id=17188

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |safe
                 CC|                            |bugzilla@digitalmars.com

--
April 12, 2017
https://issues.dlang.org/show_bug.cgi?id=17188

--- Comment #1 from Walter Bright <bugzilla@digitalmars.com> ---
The trouble is, I'm not sure how to deprecate in a way that still checks for scope.

--
October 08, 2017
https://issues.dlang.org/show_bug.cgi?id=17188

Rainer Schuetze <r.sagitario@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |r.sagitario@gmx.de

--- Comment #2 from Rainer Schuetze <r.sagitario@gmx.de> ---
As qsort is @system anyway, the callback does not have to guarantee anything. To still be able to pass a function with scope parameters, how about overloading it with both variants:

alias int function(scope const void*, scope const void*) _scope_compare_fp_t;
alias int function(const void*, const void*) _compare_fp_t;

void    qsort(scope void* base, size_t nmemb, size_t size, _scope_compare_fp_t
compar);
void    qsort(scope void* base, size_t nmemb, size_t size, _compare_fp_t
compar);

--
October 08, 2017
https://issues.dlang.org/show_bug.cgi?id=17188

--- Comment #3 from Rainer Schuetze <r.sagitario@gmx.de> ---
The overload with a non-scope callback should also not pretend to not escape the base pointer:

void    qsort(void* base, size_t nmemb, size_t size, _compare_fp_t compar);

--
December 13, 2017
https://issues.dlang.org/show_bug.cgi?id=17188

Seb <greensunny12@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |greensunny12@gmail.com
         Resolution|---                         |WONTFIX

--- Comment #4 from Seb <greensunny12@gmail.com> ---
It's been more than ten months since the bug was report, hence I think that triggering a deprecation message now, would be way too late -> closing.

--
December 16, 2017
https://issues.dlang.org/show_bug.cgi?id=17188

--- Comment #5 from Rainer Schuetze <r.sagitario@gmx.de> ---
My suggestion with two overloads would not need a deprecation, but allow both scope and non-scope versions.

--
December 16, 2017
https://issues.dlang.org/show_bug.cgi?id=17188

ZombineDev <petar.p.kirov@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |petar.p.kirov@gmail.com
         Resolution|WONTFIX                     |---

--- Comment #6 from ZombineDev <petar.p.kirov@gmail.com> ---
I agree with Rainer that we should use overloading.

--
February 28, 2018
https://issues.dlang.org/show_bug.cgi?id=17188

Martin Nowak <code@dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code@dawg.eu

--- Comment #7 from Martin Nowak <code@dawg.eu> ---
> As qsort is @system anyway, the callback does not have to guarantee anything. To still be able to pass a function with scope parameters, how about overloading it with both variants

I think we:

- Need to add some sort of wildcard attribute for such cases, as declinating all 16 combinations of `@nogc`, `pure`, `nothrow`, `@safe` callbacks isn't feasible.

- Should simply remove scope in this specific case as the function is @system and scope won't be checked anyhow, overloading with both variants doesn't buy us anything.

--
February 28, 2018
https://issues.dlang.org/show_bug.cgi?id=17188

Martin Nowak <code@dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|`core.stdc.stdlib.qsort()`  |stdc qsort predicate
                   |is broken                   |requires scope parameters

--
« First   ‹ Prev
1 2