Bug 12715 – _compare_fp_t/qsort/bsearch C functions should be nothrow

Status
NEW
Severity
normal
Priority
P3
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-05-08T08:48:43Z
Last change time
2024-12-07T13:33:49Z
Keywords
pull
Assigned to
No Owner
Creator
Denis Shelomovskii
Moved to GitHub: dmd#17276 →

Comments

Comment #0 by verylonglogin.reg — 2014-05-08T08:48:43Z
It's a bad idea to throw exceptions across language boundaries as there is no guarantee a C standard library doesn't use its own exception handler for some reason. So `_compare_fp_t` should be `nothrow`. Causing pull: https://github.com/D-Programming-Language/druntime/pull/779
Comment #1 by bugzilla — 2014-05-09T09:22:27Z
This is deliberate. The reason is to not break existing code. People shouldn't have to go back and annotate code with 'nothrow' that was already working.
Comment #2 by verylonglogin.reg — 2014-05-09T09:46:08Z
(In reply to Walter Bright from comment #1) > This is deliberate. The reason is to not break existing code. People > shouldn't have to go back and annotate code with 'nothrow' that was already > working. But this code isn't "working". It's wrong and is a source of heisenbugs like every other code throwing exceptions across language boundaries. I see no excuse to have incorrect C library bindings and thus force D users to pay on-going cost of fixing heisenbugs because of it. And yes, it isn't a regression.
Comment #3 by code — 2014-05-09T13:27:58Z
(In reply to Walter Bright from comment #1) > This is deliberate. The reason is to not break existing code. People > shouldn't have to go back and annotate code with 'nothrow' that was already > working. Those callbacks were annotated nothrow 4 years ago so the code breaking argument doesn't make sense. https://github.com/WalterBright/druntime/commit/370ffd8d6da3978f742fd17572b418aaf85db355 Pull: https://github.com/D-Programming-Language/druntime/pull/787
Comment #4 by code — 2014-05-09T13:35:25Z
(In reply to Martin Nowak from comment #3) > (In reply to Walter Bright from comment #1) > > This is deliberate. The reason is to not break existing code. People > > shouldn't have to go back and annotate code with 'nothrow' that was already > > working. > > Those callbacks were annotated nothrow 4 years ago so the code breaking > argument doesn't make sense. > https://github.com/WalterBright/druntime/commit/ > 370ffd8d6da3978f742fd17572b418aaf85db355 Sorry for the noise, global attributes do not affect function types in function signatures, so you were right about the code breakage.
Comment #5 by robert.schadek — 2024-12-07T13:33:49Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17276 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB