[Issue 8887] static arrays passed by value in extern C/C++ functions should not compile

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Nov 7 08:11:13 PST 2014


https://issues.dlang.org/show_bug.cgi?id=8887

Dicebot <public at dicebot.lv> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |industry
           Priority|P2                          |P1
             Status|RESOLVED                    |REOPENED
                 CC|                            |public at dicebot.lv
         Resolution|WONTFIX                     |---
           Severity|normal                      |regression

--- Comment #3 from Dicebot <public at dicebot.lv> ---
Reopining it and marking as critical regression issue. Also with "industry"
keyword.

This is regression from D1 behaviour that makes all of our existing extern(C)
bindings segfault when compiled with D2 compiler. Only workaroun possible to
replace it with pointer arguments everywhere, losing important chunk of type
safety in process.

However I don't like compilation failure here either. extern(C) functions must
comply to C ABI and thus pass static arrays by pointer even if normal D
functions do that by value.

Walter original reasoning about breaking original code is completely
unapplicable here as any code that currently compiles with this pattern will
segfault at runtime anyway. There can't be any legit working code out there to
break.

--


More information about the Digitalmars-d-bugs mailing list