Jump to page: 1 25  
Page
Thread overview
July 13

The -release flag is equivalent to -O -boundscheck=safeonly -inline.

I think we should remove it. If you want no bounds checks, you should have to really want it enough to type that whole monstrosity in. It's trivial to avoid bounds checks by using .ptr[index] in @system code. In my dub projects, I rewrite the release mode to keep bounds checks for all code, it's that important.

What do you think? Deprecate for 3 versions, then remove.

-Steve

July 12
On Sat, Jul 13, 2024 at 01:55:16AM +0000, Steven Schveighoffer via Digitalmars-d wrote:
> The `-release` flag is equivalent to `-O -boundscheck=safeonly -inline`.
> 
> I think we should remove it. If you want no bounds checks, you should have to really want it enough to type that whole monstrosity in. It's trivial to avoid bounds checks by using `.ptr[index]` in `@system` code. In my dub projects, I rewrite the release mode to keep bounds checks for all code, it's that important.
> 
> What do you think? Deprecate for 3 versions, then remove.
[...]

+1.


T

-- 
Fact is stranger than fiction.
July 13

On Saturday, 13 July 2024 at 01:55:16 UTC, Steven Schveighoffer wrote:

>

The -release flag is equivalent to -O -boundscheck=safeonly -inline.

I think we should remove it. If you want no bounds checks, you should have to really want it enough to type that whole monstrosity in. It's trivial to avoid bounds checks by using .ptr[index] in @system code. In my dub projects, I rewrite the release mode to keep bounds checks for all code, it's that important.

What do you think? Deprecate for 3 versions, then remove.

-Steve

+1 on less flags if the equivalent exist already.

I think it's better(principle of least surprise) if developers explicitly turn on/off or what level (i.e. safe only) for boundschecking as well.

July 13

On Saturday, 13 July 2024 at 01:55:16 UTC, Steven Schveighoffer wrote:

>

The -release flag is equivalent to -O -boundscheck=safeonly -inline.

Almost: https://github.com/dlang/dmd/blob/82eee6f4e0291e58803dc4e86a6ea236094e91ea/compiler/src/dmd/link.d#L272

That particular... quirk, has been there since at least the C++ transition. Is it still needed?
I don't use windows so I have no way of checking, I suspect not though.

>

I think we should remove it...
What do you think? Deprecate for 3 versions, then remove.

Sounds good to me.

Nic

July 13

On Saturday, 13 July 2024 at 04:43:07 UTC, Nicholas Wilson wrote:

>

On Saturday, 13 July 2024 at 01:55:16 UTC, Steven Schveighoffer wrote:

>

The -release flag is equivalent to -O -boundscheck=safeonly -inline.

Almost:

Actually I got that wrong. There is:

  • that that small Windows linker thing
  • it does not imply -O nor does it imply -inline
  • it does imply -boundscheck=safeonly
  • it also implies everything in -check=off (except for boundscheck, which is set to safeonly), that is to say it additionally disables: invariants, (in and out) contracts, asserts, and switch errors.
July 13

On Saturday, 13 July 2024 at 01:55:16 UTC, Steven Schveighoffer wrote:

>

I think we should remove it. What do you think? Deprecate for 3 versions, then remove.

First thing we need to do is go through the test suite and determine why (i.e. what bits of its implications) -release is required in those tests, and replace it with the switches that need to be tested.

Any help with the archeology much appriciated.

July 12
Why -release is the way it is:

I got sick of journalists running benchmarks using compilers they weren't familiar with. They never spent any effort learning what the switches were.

The big vendors would wine and dine them and show them exactly how to run their compilers. With mine, they never talked to me. I wouldn't even know they did a review until it hit the news stand.

They'd use the wrong switches, the code would run slow, and I'd get a bad review.

The -release switch means "make the fastest code". Make it easy for the journalists to do the right thing.

Nobody new to D will know to use -O -boundscheck-safeonly -inline. They'll just get a "D is slow" result and move on.
July 13

On Saturday, 13 July 2024 at 05:06:02 UTC, Nicholas Wilson wrote:

>
  • it does not imply -O nor does it imply -inline

This was a surprise for me! For a long time I thought -release implied these...

So -release is even more useless than I remembered. We definitely should get rid of it.

-Steve

July 13

On Saturday, 13 July 2024 at 05:35:53 UTC, Walter Bright wrote:

>

Why -release is the way it is:

I got sick of journalists running benchmarks using compilers they weren't familiar with. They never spent any effort learning what the switches were.

The big vendors would wine and dine them and show them exactly how to run their compilers. With mine, they never talked to me. I wouldn't even know they did a review until it hit the news stand.

They'd use the wrong switches, the code would run slow, and I'd get a bad review.

The -release switch means "make the fastest code". Make it easy for the journalists to do the right thing.

Nobody new to D will know to use -O -boundscheck-safeonly -inline. They'll just get a "D is slow" result and move on.

I think it's fair to say no "journalists" are reviewing D in print. For sure, people who try to run benchmarks will at least look for the proper optimization flags, and I bet nobody is looking to remove bounds checks.

Let's just remove it. What it does now is fool people into thinking this is for when you want to release your library/application. If nothing else, it should be renamed to -removesafetychecks or something.

Note, I was wrong about the -O and -inline being implied -- you still have to put those in. -release just gets rid of all the safety checks.

-Steve

July 13

On Saturday, 13 July 2024 at 05:55:13 UTC, Steven Schveighoffer wrote:

> >

I think it's fair to say no "journalists" are reviewing D in print. For sure, people who try to run benchmarks will at least look for the proper optimization flags, and I bet nobody is looking to remove bounds checks.

Let's just remove it. What it does now is fool people into thinking this is for when you want to release your library/application. If nothing else, it should be renamed to -removesafetychecks or something.

Note, I was wrong about the -O and -inline being implied -- you still have to put those in. -release just gets rid of all the safety checks.

Leave the flag in place but have the compiler print the following message...

"DMD optimized code is sloooowww, try using LDC instead"

« First   ‹ Prev
1 2 3 4 5