Re: avoid codegen pass

2021-10-02 Thread Padlev via Digitalmars-d-learn
On Saturday, 2 October 2021 at 13:26:27 UTC, Adam D Ruppe wrote: On Saturday, 2 October 2021 at 13:24:19 UTC, Padlev wrote: -o- how to run only semantic and avoid codegen to have a quicker run? -o- does skip codegen already so why this? it seems to take a long time from the last import

Re: avoid codegen pass

2021-10-02 Thread Dennis via Digitalmars-d-learn
On Saturday, 2 October 2021 at 16:57:48 UTC, max haughton wrote: Do you have optimizations turned on? i.e. are you compiling with -O by accident? Not needed, it's declared: ```D pragma(inline, true) @property _timezone() @safe const pure nothrow @nogc ``` DMD does inlining in the frontend,

Re: avoid codegen pass

2021-10-02 Thread max haughton via Digitalmars-d-learn
On Saturday, 2 October 2021 at 14:44:16 UTC, Padlev wrote: On Saturday, 2 October 2021 at 13:26:27 UTC, Adam D Ruppe wrote: On Saturday, 2 October 2021 at 13:24:19 UTC, Padlev wrote: -o- how to run only semantic and avoid codegen to have a quicker run? -o- does skip codegen already so

Re: Rather Bizarre slow downs using Complex!float with avx (ldc).

2021-10-02 Thread Guillaume Piolat via Digitalmars-d-learn
On Friday, 1 October 2021 at 08:32:14 UTC, james.p.leblanc wrote: Does anyone have insight to what is happening? Thanks, James Maybe something related to: https://gist.github.com/rygorous/32bc3ea8301dba09358fd2c64e02d774 ? AVX is not always a clear win in terms of performance. Processing

Re: Mutually recursive template expansion

2021-10-02 Thread Stephen via Digitalmars-d-learn
On Friday, 1 October 2021 at 14:26:39 UTC, jfondren wrote: On Friday, 1 October 2021 at 14:03:06 UTC, Stephen wrote: This code should work should mutual recursion be supported. It still wouldn't work, because structs are value types and it's impossible to say how large either struct is:

Re: Mutually recursive template expansion

2021-10-02 Thread Imperatorn via Digitalmars-d-learn
On Friday, 1 October 2021 at 14:03:06 UTC, Stephen wrote: I've been trying out templates in more depth and one thing I was wondering was whether template expansions with circular dependencies might work. Here is an example that doesn't work: ```d mixin(A!()); mixin(B!()); void main() {}

Re: avoid codegen pass

2021-10-02 Thread Adam D Ruppe via Digitalmars-d-learn
On Saturday, 2 October 2021 at 13:24:19 UTC, Padlev wrote: -o- how to run only semantic and avoid codegen to have a quicker run? -o- does skip codegen already

Re: Mutually recursive template expansion

2021-10-02 Thread Basile B. via Digitalmars-d-learn
On Saturday, 2 October 2021 at 08:48:24 UTC, Stephen wrote: Is this by design? No but it's easily explainable. ## without mixins ```d struct Ar { Br b; ubyte a; } struct Br { ubyte b; } ``` `Ar` semantic starts, members are analyzed, that begins with the variable declaration `Br b`. `Br`

avoid codegen pass

2021-10-02 Thread Padlev via Digitalmars-d-learn
hello, i run dmd from editor to check syntax of what i am writing, with -c -o-. how to run only semantic and avoid codegen to have a quicker run?

Re: How use ldc pragmas?

2021-10-02 Thread james.p.leblanc via Digitalmars-d-learn
On Friday, 1 October 2021 at 19:23:06 UTC, james.p.leblanc wrote: D-ers, Update from myself to myself (and any others who might use the bash command from my origin posting), I try to compile the above using: ```bash ldc2 -mattr=+avx2 myexample.d -H ~/ldc2/import/ldc/gccbuiltins_x86.di

Re: avoid codegen pass

2021-10-02 Thread russhy via Digitalmars-d-learn
On Saturday, 2 October 2021 at 22:40:32 UTC, max haughton wrote: On Saturday, 2 October 2021 at 18:05:06 UTC, Dennis wrote: On Saturday, 2 October 2021 at 16:57:48 UTC, max haughton wrote: Do you have optimizations turned on? i.e. are you compiling with -O by accident? Not needed, it's

Regular Templates May Be `mixin`d?

2021-10-02 Thread surlymoor via Digitalmars-d-learn
```d // Modified sixth example from https://dlang.org/spec/template-mixin.html int y = 3; template Foo() { int abc() { return y; } } void main() { int y = 8; mixin Foo; // local y is picked up, not global y assert(abc() == 8); } ``` This compiles and works. I checked the

Template mixin problem with EnumMembers

2021-10-02 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
The below code works as expected on https://run.dlang.io/, but not on my computer. And I don't know why? I want to access enum members like Options.OUT_FILE_NAME instead of Options.StringOption.OUT_FILE_NAME. Please note that the solutions like "alias something = int;" don't work for me.

Re: Template mixin problem with EnumMembers

2021-10-02 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Saturday, 2 October 2021 at 22:24:56 UTC, Adam Ruppe wrote: On Saturday, 2 October 2021 at 22:07:23 UTC, Ferhat Kurtulmuş wrote: [...] You used .stringof. That's undefined behavior. Never use stringof. (except for debugging writes) [...] Thank you Adam! I should stop using stringof.

Re: Regular Templates May Be `mixin`d?

2021-10-02 Thread surlymoor via Digitalmars-d-learn
On Sunday, 3 October 2021 at 03:04:29 UTC, Paul Backus wrote: On Sunday, 3 October 2021 at 02:52:20 UTC, surlymoor wrote: This compiles and works. I checked the spec, and I don't see anything; probably missed it, however; mentioning the fact that regular templates may be used with `mixin`. Is

Re: Template mixin problem with EnumMembers

2021-10-02 Thread Adam Ruppe via Digitalmars-d-learn
On Saturday, 2 October 2021 at 22:07:23 UTC, Ferhat Kurtulmuş wrote: The below code works as expected on https://run.dlang.io/, but not on my computer. And I don't know why? You used .stringof. That's undefined behavior. Never use stringof. (except for debugging writes) Now, I'd actually

Re: avoid codegen pass

2021-10-02 Thread max haughton via Digitalmars-d-learn
On Saturday, 2 October 2021 at 18:05:06 UTC, Dennis wrote: On Saturday, 2 October 2021 at 16:57:48 UTC, max haughton wrote: Do you have optimizations turned on? i.e. are you compiling with -O by accident? Not needed, it's declared: ```D pragma(inline, true) @property _timezone() @safe const

Re: Regular Templates May Be `mixin`d?

2021-10-02 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 3 October 2021 at 02:52:20 UTC, surlymoor wrote: This compiles and works. I checked the spec, and I don't see anything; probably missed it, however; mentioning the fact that regular templates may be used with `mixin`. Is this expected? Yes, this is intentional and expected. From