Re: Which D compiler is the most maintained and future-proof? [DMD GDC and LDC]

2023-07-24 Thread Guillaume Piolat via Digitalmars-d-learn

On Monday, 24 July 2023 at 09:20:05 UTC, BoQsc wrote:
There are three compilers present in the Dlang website: DMD GDC 
and LDC


DMD can build much faster than LDC. In some cases it is quite 
extreme, for example the product I work on has a 3.6x faster 
debug build time with DMD (well, only with --combined -b debug).


It may be a bit more crucial that it seems to work with DMD for 
fast iteration, if you need a lot of experiments. It seems the 
product is benefiting from using DMD for prototyping, even though 
it was an accident at first.


I wanted to compare the run times, but the same project doesn't 
build with DMD and optimizations. Usually LDC is 2x the speed, 
and LLVM output accelerate a bit over time as the optimizer gets 
smarter.


(Numbers with LDC 1.33.0 and DMD 2.104.0)


Re: Which D compiler is the most maintained and future-proof? [DMD GDC and LDC]

2023-07-24 Thread Johan via Digitalmars-d-learn
On Monday, 24 July 2023 at 13:51:06 UTC, Steven Schveighoffer 
wrote:


DMD is the point of all D feature introductions, and so 
anything that works with LDC should work with DMD.


It's the other way around that might cause trouble, since there 
may be DMD features which haven't yet made it into LDC.


I understand what you mean, but a key reason to use LDC or GDC is 
for all the features that DMD does not have.

- support for more platforms
- CPU intrinsics, more extensive inline assembly
- sanitizers, fuzzing
- special function/variable attributes (e.g. @section, @weak, ...)

To the OP's question, I don't think _any_ of the 3 compilers is 
"future proof". But we'd need a better definition of what OP 
means with "future proof" to give a better answer.


regards,
  Johan



Re: Which D compiler is the most maintained and future-proof? [DMD GDC and LDC]

2023-07-24 Thread Dennis via Digitalmars-d-learn

On Monday, 24 July 2023 at 13:30:27 UTC, cc wrote:
Is there any list of known significant "gotchas" with moving to 
LDC from DMD?  Any unexpected surprises to watch out for or be 
careful for?


- DMD has weak linking for all functions by default (mostly as a 
workaround to several bugs). In LDC, you might get 'duplicate 
definition' errors when linking D objects that succeeds when 
compiled with dmd.


- DMD supports C opaque struct definitions in headers (though 
arguably a bug as well) while LDC will complain, see 
https://github.com/ldc-developers/ldc/issues/3817


Known edge cases of compiler optimization causing different 
behavior between vendors?


LDC can optimize much more aggressively, so if your code has 
undefined behavior, it's more likely to manifest as a bug with 
LDC. I had a unittest that succeeded with dmd but failed with 
`ldc2 -O3` because there was a bitshift larger than 63. DMD 
didn't care much (it would just do modulo 64), but LDC optimized 
the function based on the assumption that a parameter could never 
be 0, which I didn't intend.


Re: Which D compiler is the most maintained and future-proof? [DMD GDC and LDC]

2023-07-24 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn

On 25/07/2023 1:26 AM, devosalain wrote:

I could be interesting to also compare the licenses of the 3 compilers.


There isn't a huge difference between them.

The frontend, druntime and most of phobos (minus zlib and curl) are all 
Boost regardless of compiler.


That just leaves backends, which depends upon GCC and LLVM. So if you 
can use GCC and Clang, your fine to use GDC and LDC.


Re: Which D compiler is the most maintained and future-proof? [DMD GDC and LDC]

2023-07-24 Thread Steven Schveighoffer via Digitalmars-d-learn

On 7/24/23 9:30 AM, cc wrote:
On Monday, 24 July 2023 at 09:29:09 UTC, Richard (Rikki) Andrew 
Cattermole wrote:

There isn't a huge concern with which one you use.

Its quite common to use dmd for development, and ldc for release for 
example.


They all share the same frontend, so they really only differ between 
them by their glue code to the relevant backend and some modules in 
druntime that are optional. Oh and inline assembly, although there is 
some compat code in ldc/gdc for dmd style.


If dmd dies, so does ldc/gdc basically. Each one sees active 
development although gdc only has one developer. Ldc keeps up with the 
dmd releases pretty well.


If DMD dies, the other two will live on. This is open source after all.



Is there any list of known significant "gotchas" with moving to LDC from 
DMD?  Any unexpected surprises to watch out for or be careful for?  I'm 
thinking of all the "features" of DMD that are now considered verboten 
by many users (e.g. compiling with -release, disabling of asserts or 
array bounds checking, etc). Known edge cases of compiler optimization 
causing different behavior between vendors?




DMD is the point of all D feature introductions, and so anything that 
works with LDC should work with DMD.


It's the other way around that might cause trouble, since there may be 
DMD features which haven't yet made it into LDC.


There are also subtle ways to consider things "broken" which might 
affect you if you care about that. Like for instance floating point 
handling is different, so you might not get exactly the same binary results.


-Steve


Re: Which D compiler is the most maintained and future-proof? [DMD GDC and LDC]

2023-07-24 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn



On 25/07/2023 1:30 AM, cc wrote:
Is there any list of known significant "gotchas" with moving to LDC from 
DMD?  Any unexpected surprises to watch out for or be careful for?  I'm 
thinking of all the "features" of DMD that are now considered verboten 
by many users (e.g. compiling with -release, disabling of asserts or 
array bounds checking, etc). Known edge cases of compiler optimization 
causing different behavior between vendors?


No, there is no list.

The main gotcha I know of is inline assembly being a bit different. Also 
the glue code for LDC hasn't got ``extern(Objective-C)`` implemented 
currently. I don't know about GDC.


Over all, if you are familiar with GCC & Clang, you'll be ok. A lot of 
the flags from dmd have a comparable version (if not split up further) 
in LDC and GDC.


Re: Which D compiler is the most maintained and future-proof? [DMD GDC and LDC]

2023-07-24 Thread cc via Digitalmars-d-learn
On Monday, 24 July 2023 at 09:29:09 UTC, Richard (Rikki) Andrew 
Cattermole wrote:

There isn't a huge concern with which one you use.

Its quite common to use dmd for development, and ldc for 
release for example.


They all share the same frontend, so they really only differ 
between them by their glue code to the relevant backend and 
some modules in druntime that are optional. Oh and inline 
assembly, although there is some compat code in ldc/gdc for dmd 
style.


If dmd dies, so does ldc/gdc basically. Each one sees active 
development although gdc only has one developer. Ldc keeps up 
with the dmd releases pretty well.


Is there any list of known significant "gotchas" with moving to 
LDC from DMD?  Any unexpected surprises to watch out for or be 
careful for?  I'm thinking of all the "features" of DMD that are 
now considered verboten by many users (e.g. compiling with 
-release, disabling of asserts or array bounds checking, etc).  
Known edge cases of compiler optimization causing different 
behavior between vendors?




Re: Which D compiler is the most maintained and future-proof? [DMD GDC and LDC]

2023-07-24 Thread devosalain via Digitalmars-d-learn
I could be interesting to also compare the licenses of the 3 
compilers.


Is it possible to make an Linux Executable Binary using a Windows Operating System? [compiling and linking]

2023-07-24 Thread 00004 via Digitalmars-d-learn
Could someone share a step by step way to compile and link a 
x86-64 Linux Binary using Windows 10? (Without virtual machine or 
"Linux Subsystem for Windows")


I want to compile and link a Hello World program for both Linux 
and Windows.


**example.d**
```
import std.stdio;

void main()
{
writeln("Hello, World!");
}
```

So I need `.exe` binary for windows
and a runnable linux binary for linux.


Re: Which D compiler is the most maintained and future-proof? [DMD GDC and LDC]

2023-07-24 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn

There isn't a huge concern with which one you use.

Its quite common to use dmd for development, and ldc for release for 
example.


They all share the same frontend, so they really only differ between 
them by their glue code to the relevant backend and some modules in 
druntime that are optional. Oh and inline assembly, although there is 
some compat code in ldc/gdc for dmd style.


If dmd dies, so does ldc/gdc basically. Each one sees active development 
although gdc only has one developer. Ldc keeps up with the dmd releases 
pretty well.


Which D compiler is the most maintained and future-proof? [DMD GDC and LDC]

2023-07-24 Thread BoQsc via Digitalmars-d-learn
There are three compilers present in the Dlang website: DMD GDC 
and LDC