August 30, 2022
On Tuesday, 30 August 2022 at 15:50:48 UTC, Walter Bright wrote:
> -release is for people who do speed benchmarks.

The documentation should outright say then "never use this unless you are cheating on an artificial speed benchmark".
August 30, 2022
On Tuesday, 30 August 2022 at 16:16:38 UTC, Adam D Ruppe wrote:
> On Tuesday, 30 August 2022 at 15:50:48 UTC, Walter Bright wrote:
>> -release is for people who do speed benchmarks.
>
> The documentation should outright say then "never use this unless you are cheating on an artificial speed benchmark".

-release says use me in terms of meaning, but masters says don't use it. I didn't know it had such dire consequences. This is an issue that affects contract programming.

SDB@79
August 30, 2022
On Tuesday, 30 August 2022 at 15:55:27 UTC, Walter Bright wrote:
> [snip]
> I've also written here that there are legitimate uses of NaN where quitting upon use is undesirable.
>
> [snip]

I feel like there aren't a lot of people here who do data analysis with missing data...NaNs all over the place...
August 30, 2022
On Tue, Aug 30, 2022 at 04:16:38PM +0000, Adam D Ruppe via Digitalmars-d wrote:
> On Tuesday, 30 August 2022 at 15:50:48 UTC, Walter Bright wrote:
> > -release is for people who do speed benchmarks.
> 
> The documentation should outright say then "never use this unless you are cheating on an artificial speed benchmark".

It should be renamed to -optimize-for-benchmark. ;-)


T

-- 
"A man's wife has more power over him than the state has." -- Ralph Emerson
August 30, 2022
On Tuesday, 30 August 2022 at 16:01:24 UTC, rikki cattermole wrote:
>
> I've talked about this quite a bit with Bruce.
>
> Our conclusion has been that explicit vectorization is usually the wrong path to take. It eats up developer time and provides very little benefit in majority of cases.

Well I wasn't talking about manual vectorization vs autovectorization, but about @fastMath. That is another debate, and I'm of a different opinion, FWIW.
August 30, 2022
On 8/30/2022 9:25 AM, Salih Dincer wrote:
> On Tuesday, 30 August 2022 at 16:16:38 UTC, Adam D Ruppe wrote:
>> On Tuesday, 30 August 2022 at 15:50:48 UTC, Walter Bright wrote:
>>> -release is for people who do speed benchmarks.
>>
>> The documentation should outright say then "never use this unless you are cheating on an artificial speed benchmark".
> 
> -release says use me in terms of meaning, but masters says don't use it. I didn't know it had such dire consequences. This is an issue that affects contract programming.

It's not dire. It's just necessary to understand what's happening. People who do speed benchmarks rarely do more than glance at the documentation, if that.

August 31, 2022
On 31.08.22 00:08, Walter Bright wrote:
> On 8/30/2022 9:25 AM, Salih Dincer wrote:
>> On Tuesday, 30 August 2022 at 16:16:38 UTC, Adam D Ruppe wrote:
>>> On Tuesday, 30 August 2022 at 15:50:48 UTC, Walter Bright wrote:
>>>> -release is for people who do speed benchmarks.
>>>
>>> The documentation should outright say then "never use this unless you are cheating on an artificial speed benchmark".
>>
>> -release says use me in terms of meaning, but masters says don't use it. I didn't know it had such dire consequences. This is an issue that affects contract programming.
> 
> It's not dire.

I think the term is fitting. Contracts are meant to support correctness, not to help exacerbate vulnerabilities.

> It's just necessary to understand what's happening.

People do not understand this. People barely understand undefined behavior. E.g., there were presentations at dconf where people were like: "we tested it [the piece of code with UB] and it worked, hence it is correct".

A somewhat common use case is to disable contract/assert checking. Most people just assume that's what happens because introducing UB is not reasonable behavior.

> People who do speed benchmarks rarely do more than glance at the documentation, if that.
> 

People who don't know how to use the language usually write slow code anyway. (And it often computes only NaNs.)
August 31, 2022
On 30.08.22 17:47, Walter Bright wrote:
> On 8/29/2022 5:27 PM, Timon Gehr wrote:
>> Clearly you should throw away your computer after a failed assert.
> 
> Absolutely. My basement is full of junked computers that dared to fail.
> 
> 
>> Which is why asserts can introduce new _undefined behavior_?
> 
> DMD has a switch to insert a halt instruction upon assertion failures.

Let's assume whoever is compiling my code does not want to spend computational resources on checking my asserts. (Or invariants, etc.)

My problem is that DMD seems to _lack_ switches to _safely_ disable checking (as far as I understand; it's notoriously underdocumented).

The fact that something that's called "turn off checking" will introduce UB is just really bad UX design. You are nothing short of ensuring that the hydraulic lines are hooked to the wrong ports.

Aside: My experience with people running into "Illegal instruction" is that they just assume the compiler has a bug and produced invalid machine code. Also, the semantics of "hlt" is not to terminate anything at all, it just waits for the next interrupt to be fired. The only reason it crashes in user space is that it requires ring 0 access.
August 31, 2022
On Wednesday, 31 August 2022 at 02:05:21 UTC, Timon Gehr wrote:
> Also, the semantics of "hlt" is not to terminate anything at all

It actually uses UD2 now (I've been complaining about this for years and it actually got changed in Dec 2017, so long time ago, but Walter's old habits die hard)

https://github.com/dlang/dmd/pull/7391
August 30, 2022
On Wed, Aug 31, 2022 at 04:05:21AM +0200, Timon Gehr via Digitalmars-d wrote: [...]
> Also, the semantics of "hlt" is not to terminate anything at all, it just waits for the next interrupt to be fired. The only reason it crashes in user space is that it requires ring 0 access.

Hmm. I was pretty sure the convention, at least on x86 architectures, is that hlt in userspace is a signal to the OS that the program has terminated itself (usually abnormally, since normal termination is usually via the exit syscall, at least on Posix).


T

-- 
It won't be covered in the book. The source code has to be useful for something, after all. -- Larry Wall