-
-
Notifications
You must be signed in to change notification settings - Fork 423
Conversation
d4d6b84
to
e5348ec
Compare
win64.mak
Outdated
DFLAGS=-m$(MODEL) -conf= -O -release -dip1000 -inline -w -Isrc -Iimport | ||
UDFLAGS=-m$(MODEL) -conf= -O -release -dip1000 -w -Isrc -Iimport | ||
DFLAGS=-m$(MODEL) -conf= -O -release -dip1000 -dip1008 -inline -w -Isrc -Iimport | ||
UDFLAGS=-m$(MODEL) -conf= -O -release -dip1000 -dip1008 -w -Isrc -Iimport |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding -dip1008 seems unrelated. There are also a couple more unrelated changes to win64.mak that cause build failures.
src/core/stdc/assert_.d
Outdated
} | ||
else version (CRuntime_Microsoft) | ||
{ | ||
void _assert(const(char)* exp, const(char)* file, uint line); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no _assert in the MS runtime, they use _wassert with wide strings only:
void __cdecl _wassert(const wchar_t * _Message, const wchar_t *_File, unsigned _Line);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, there is. It just isn't in the .h file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. A comment would be nice for the next time I stumble over this.
Should we add the _wassert version, too, similar to the various declaration on the other platforms?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
Not a blocker, but the documentation only lists the glibc version declarations. This can be pretty confusing for other platforms. The ddox documentation doesn't list any function at all. |
extern (C): | ||
@trusted: | ||
nothrow: | ||
@nogc: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pure
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that a function never returning means it is pure
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I understand, this provides an alternative to built-in assert
. Since the built-in assert
is usable from pure
functions, I think this should also be.
I'm not sure that a function never returning means it is pure.
That should never happen in correct programs. But in general pure
functions are allowed to terminate the program, according to the language spec. So I think the C assert
functions fit the bill.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @ZombineDev, should be pure
. The betterC purists will come back at you anyway without it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pure functions that return void can be elided by the compiler.
I think this would be more useful with a template |
The purpose of these imports is not to fix the interface, but to simply declare it. |
If these functions are actually elided, then we'll have to go without |
The C interface is |
The solution is a |
We also declare the internal functions in the |
Sure, I never said these should be removed. But without an implementation of the C assert macro, everyone will have to implement their own version forwarding to the platform specific functions. |
This will also need a |
Every function is mightnotreturn. It's OT anyway. |
If that's true you must not elide any pure function if you want to keep the side effect of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move forward with this. A C assert wrapper can be added later if the need pops up. We have lived without it for years.
For those who would want to call the C assert function rather than the druntime one.