On Sunday, 21 July 2024 at 05:43:32 UTC, IchorDev wrote:
Does this mean that array literals are *always* separately
allocated first, or is this usually optimised out?
Not always allocated, see your example below.
I don't quite know what the heuristic is for allocation or not...
For
On Sunday, 21 July 2024 at 13:35:46 UTC, Troy wrote:
void create(void* b) {
std::string s = "engineer again";
*(std::string*)(b) = s;// Segfault here
}
You have to construct an empty string object first in location
`b` (emplacement new). Then you can assign to it as you do.
On Tuesday, 13 February 2024 at 08:10:20 UTC, Jonathan M Davis
wrote:
So, there's definitely a bug here, but it's a dmd bug. Its
checks for whether it can safely change the constness of the
return type apparently aren't sophisticated enough to catch
this case.
This is a pretty severe bug.
On Monday, 12 February 2024 at 16:14:27 UTC, Per Nordlöw wrote:
. Doing the same thing with LDC via
```sh
ldc2 -g --d-debug -run app
```
gives
```
ld: error: undefined symbol:
_D3etc5linux11memoryerror26registerMemoryErrorHandlerFNbZb
referenced by app.d:3
On Thursday, 25 January 2024 at 16:07:44 UTC, Stefan Koch wrote:
On Thursday, 25 January 2024 at 15:39:08 UTC, ryuukk_ wrote:
```D
void main()
{
char[32] id = 0;
id = "hello";
}
```
this works fine, and that is what i expect for the example
above..
Raise a bug, I'll fix it.
Hmm.
On Wednesday, 27 December 2023 at 16:35:47 UTC, Paul Backus wrote:
On Wednesday, 27 December 2023 at 15:57:14 UTC, tososdk wrote:
Two things: Could you explain how "inline" works? Is there
something similar in Dlang?
I don't think the D forums is the best place to ask about how
"inline"
On Saturday, 23 December 2023 at 20:42:37 UTC, Etienne Cimon
wrote:
I'm having a problem implementing the `new` keyword, so that I
can start importing more libraries with minimal change.
However, LDC calls .object._d_newitemT!T from the original
druntime - which I need for compile-time
Some general advice:
1 - use `dub` from LDC's package (this may solve some arm64 vs
x86 issues when on Apple Silicon CPU)
2 - when you use a new or different compiler, you have to rebuild
_all_ packages. So clear your dub cache.
I think point 2 is causing your issues.
-Johan
On Wednesday, 13 December 2023 at 18:32:50 UTC, Renato wrote:
On Wednesday, 4 October 2023 at 11:01:08 UTC, Johan wrote:
On Tuesday, 3 October 2023 at 23:55:05 UTC, confuzzled wrote:
Any known workaround for this most recent issue on macOS
Sonoma? The file I'm compiling contains a blank main()
On Saturday, 4 November 2023 at 12:01:11 UTC, Emmanuel Danso
Nyarko wrote:
On Saturday, 4 November 2023 at 11:18:02 UTC, Dadoum wrote:
```d
extern (C) void hello(string arg) {
import std.stdio;
writeln(arg);
}
```
Compiles fine with dmd, ldc2 and gdc.
```d
extern (C++) void
On Tuesday, 3 October 2023 at 23:55:05 UTC, confuzzled wrote:
Any known workaround for this most recent issue on macOS
Sonoma? The file I'm compiling contains a blank main() without
any imports but this error shows up on everything I've
attempted to compile since upgrading to Sonoma.
On Sunday, 17 September 2023 at 17:10:16 UTC, evilrat wrote:
On Sunday, 17 September 2023 at 15:05:59 UTC, Vitaliy Fadeev
wrote:
It works! But I want to ask how to make this 100% the best of
the best?
What should I consider before changing ```__vptr``` ?
If that works for you with that
On Monday, 31 July 2023 at 00:32:07 UTC, ryuukk_ wrote:
I reworked the PR, here is the new link:
https://github.com/dlang/dmd/pull/15479
It basically add support for ``pragma(lib, "local:bin/lib.a");``
Makes things easier, and doesn't change any old behavior
Before continuing with the PR,
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
On Wednesday, 19 July 2023 at 11:27:14 UTC, Richard (Rikki)
Andrew Cattermole wrote:
[...] you would have to do a new build of druntime/phobos
special which isn't the easiest thing to do.
Side remark: LDC ships with the ldc-build-runtime tool which
should help the user a lot in building
On Tuesday, 4 April 2023 at 07:08:52 UTC, Chris Katko wrote:
dscanner reports this as a warning:
```D
struct foo{
this()
{
/* some initial setup */
refresh();
}
void refresh() { /* setup some more stuff */}
// [warn] a virtual call inside a constructor may lead to
unexpected results in
On Friday, 3 March 2023 at 18:34:24 UTC, TheZipCreator wrote:
On Friday, 3 March 2023 at 13:42:55 UTC, ryuukk_ wrote:
On Friday, 3 March 2023 at 03:32:37 UTC, TheZipCreator wrote:
[...]
https://discourse.llvm.org/t/rfc-webassembly-reference-types-in-clang/66939
It looks like this needs
On Tuesday, 17 January 2023 at 03:48:03 UTC, Ruby The Roobster
wrote:
I just fixed a bug in my personal D hobby project. After
pushing everything to github, I noticed that it fails to link
with the latest LDC on MacOS. The error I'm getting is thus:
```
ld: warning: alignment (1) of atom
On Monday, 26 December 2022 at 19:13:01 UTC, Alexandru Ermicioi
wrote:
Hi team,
I'd like to ask a lazy question:
How easy is to use D compiler frontend without backend?
How complicated would be to write a transpiler, and from which
files should you start modifications?
I'm wondering if
On Thursday, 25 August 2022 at 14:44:22 UTC, MichaelBi wrote:
-iMac ~ % curl -fsS https://dlang.org/install.sh | bash -s dmd
Unsupported Arch arm64
I've fixed this quite some time ago:
https://github.com/dlang/installer/pull/491
Apparently it was never released?
-Johan
On Wednesday, 10 August 2022 at 09:52:10 UTC, ag0aep6g wrote:
On 10.08.22 10:20, Johan wrote:
```
shared immutable int[int] aa;
void main () {
// (cast()aa)[1] = 1; // works without immutable
(*cast(int[int]*)())[1] = 1;
}
```
We have shared static constructors for that:
shared
On Wednesday, 10 August 2022 at 00:28:53 UTC, Steven
Schveighoffer wrote:
On 8/9/22 7:02 PM, Johan wrote:
Testcase:
```
shared int[int] aa;
void main () {
cast()aa[1] = 1;
}
```
If you use `cast()(aa[1]) = 1`, it has a range error even on
older versions.
That it ever worked is
Testcase:
```
shared int[int] aa;
void main () {
cast()aa[1] = 1;
}
```
Up to dlang 2.097, this program runs and works fine.
Since dlang 2.098, the program errors with:
`core.exception.RangeError@/app/example.d(3): Range violation`
I think the 2.098+ behavior is correct, but I cannot find
On Thursday, 4 August 2022 at 20:29:30 UTC, Jan Allersma wrote:
So something goes wrong with linking, but I dont know what.
Execute `dmd -v` on some test program. It will output the linker
line at the end of the output, the line starting with `cc
yourcode.o -o yourcode ...`. On that linker
On Sunday, 24 July 2022 at 18:44:42 UTC, realhet wrote:
Hello,
I noticed that the LDC2 compiler has an architecture target
called "AMD GCN".
Is there an example code which is in D and generates a working
binary of a hello world kernel.
I tried it, and just failed at the very beginning:
On Monday, 6 June 2022 at 15:13:45 UTC, rempas wrote:
```
// mov rdx,
*cast(char*)(code + 14) = 0x48;
*cast(char*)(code + 15) = 0xC7;
*cast(char*)(code + 16) = 0xC2;
*cast(char*)(code + 17) = 12;
*cast(char*)(code + 18) = 0x00;
*cast(char*)(code + 19) = 0x00;
*cast(char*)(code +
On Saturday, 28 May 2022 at 22:23:34 UTC, kdevel wrote:
On Saturday, 28 May 2022 at 15:10:25 UTC, Steven Schveighoffer
wrote:
[...]
Is this specific to gdc, or does it happen for other compilers
as well?
The former.
Please check the dlang versions of all compilers. The template
emission
On Tuesday, 17 May 2022 at 06:28:10 UTC, cc wrote:
On Monday, 16 May 2022 at 15:08:15 UTC, H. S. Teoh wrote:
For anything performance-related, I don't even look at dmd, I
use LDC all the way. DMD is only useful for fast
compile-run-debug cycle, I don't even look at performance
numbers for
On Monday, 16 May 2022 at 21:20:43 UTC, Ali Çehreli wrote:
On 5/16/22 10:35, Johan wrote:
> What is very problematic is that you cannot see the
difference in
> syntax. In my opinion it would have been much better if the
language
> required using a `*` for class types: for example `Foo* a`,
and
On Sunday, 15 May 2022 at 16:36:05 UTC, Ali Çehreli wrote:
On 5/15/22 08:26, Kevin Bailey wrote:
> structs and classes are so different.
I think a more fundamental question is why structs and classes
both exist at all. If they could be the same, one kind would be
sufficient. And the answer
On Thursday, 12 May 2022 at 21:58:33 UTC, Ali Çehreli wrote:
I am considering proposing a presentation for DConf 2022.
Would a "Back to Basics" style presentation be interesting? If,
so what exact topic would you like to see?
Hey Ali,
When I read "Back to basics" on a program language
On Wednesday, 11 May 2022 at 09:34:20 UTC, ichneumwn wrote:
Hi Forum,
I have a snippet of code as follows:
```
extern(C) extern __gshared uint g_count;
// inside a class member function:
while(g_count) <= count) {}
```
This is from a first draft of the code without proper thread
On Wednesday, 26 January 2022 at 11:25:47 UTC, Iain Buclaw wrote:
On Wednesday, 26 January 2022 at 04:28:25 UTC, Ali Çehreli
wrote:
On 1/25/22 16:15, Johan wrote:
> On Tuesday, 25 January 2022 at 19:52:17 UTC, Ali Çehreli
wrote:
>>
>> I am using compilers installed by Manjaro Linux's package
On Tuesday, 25 January 2022 at 19:52:17 UTC, Ali Çehreli wrote:
I am using compilers installed by Manjaro Linux's package
system:
ldc: LDC - the LLVM D compiler (1.28.0):
based on DMD v2.098.0 and LLVM 13.0.0
gdc: dc (GCC) 11.1.0
dmd: DMD64 D Compiler v2.098.1
What phobos version is
On Tuesday, 25 January 2022 at 19:52:17 UTC, Ali Çehreli wrote:
I am not experienced with dub but I used
--build=release-nobounds and verified that -O3 is used for both
compilers. (I also tried building manually with GNU 'make' with
e.g. -O5 and the results were similar.)
`-O5` does not do
On Tuesday, 4 January 2022 at 22:17:38 UTC, kdevel wrote:
Is there any chance to rephrase fsobjects.d such that it
becomes a "header only"/"compile only" file of which no object
file must be presented to the linker?
https://wiki.dlang.org/LDC-specific_language_changes#LDC_no_moduleinfo
On Tuesday, 21 December 2021 at 21:09:14 UTC, eugene wrote:
On Tuesday, 21 December 2021 at 21:02:21 UTC, rempas wrote:
On Tuesday, 21 December 2021 at 19:55:13 UTC, eugene wrote:
core/sys/freebsd/config.d and core/sys/freebsd/sys/event.d
are the same as in fresh dmd, so there is not much
On Tuesday, 21 December 2021 at 10:28:15 UTC, eugene wrote:
On Monday, 20 December 2021 at 21:19:43 UTC, rempas wrote:
I would recommend you to file an
[issue](https://issues.dlang.org/) just so the developers
themself can notice it.
filed an issue, see
On Wednesday, 15 December 2021 at 09:26:28 UTC, rempas wrote:
I want to learn how to use inline assembly for LDC with GCC
syntax specifically so I can support all the targets (as
[here](https://wiki.dlang.org/Compilers) it is said that DMD
intel-like syntax only supports the "i386" and "amd64"
On Thursday, 30 September 2021 at 16:40:03 UTC, james.p.leblanc
wrote:
D-Ers,
I have been getting counterintuitive results on avx/no-avx
timing
experiments.
This could be an template instantiation culling problem. If the
compiler is able to determine that `Complex!float` is already
On Wednesday, 8 September 2021 at 04:32:50 UTC, james.p.leblanc
wrote:
1) Can we truly rely on LDC's alignment for AVX ?
Yes.
If you find wrong alignment, it's a bug.
-Johan
On Saturday, 4 September 2021 at 03:18:01 UTC, Paul Backus wrote:
On Saturday, 4 September 2021 at 00:09:37 UTC, H. S. Teoh wrote:
This is related to the bogonity of the current behaviour of
-unittest, which compiles *all* unittests of *all* imported
modules, even when you're compiling user
On Monday, 16 August 2021 at 19:30:19 UTC, JG wrote:
On Sunday, 15 August 2021 at 21:53:14 UTC, Carl Sturtivant
wrote:
On Sunday, 15 August 2021 at 07:10:17 UTC, JG wrote:
[...]
What you are asking for are reference variables. C++ has them:
the example here illustrates the behavior you
On Sunday, 15 August 2021 at 16:49:22 UTC, Paul Backus wrote:
On Sunday, 15 August 2021 at 07:10:17 UTC, JG wrote:
Hi,
This is exactly the behaviour I was trying to obtain.
It however comes with a fair amount of overhead, as can be
seen in the following llvm ir:
[...]
I'm not really
On Thursday, 17 June 2021 at 21:41:28 UTC, Steven Schveighoffer
wrote:
However, sometimes the data I'm switching on is coming from
elsewhere (i.e. a user), and while I want to enforce that the
data is valid (it's one of the enum values), I don't want to
crash the program if the incoming
On Sunday, 31 January 2021 at 16:39:12 UTC, Boris Carvajal wrote:
On Sunday, 31 January 2021 at 16:13:24 UTC, Anonymouse wrote:
Does ldc produce traces in a format that Tracy supports? I
can't seem to open the generated *.time-trace files with it.
(tracy 0.7.5-1 installed from Arch Linux AUR.)
On Friday, 9 October 2020 at 02:01:30 UTC, Andrey Zherikov wrote:
The question: is it possible to tell compiler to always
generate stack frame for my stackFrame function?
"pragma(inline, false)" doesn't help here - the result is
completely the same.
(Do you mean a stack frame, or a frame
On Tuesday, 6 October 2020 at 18:24:14 UTC, Alaindevos wrote:
There are two subtractions possible.
A machine-one which can be architecture dependent, does not
have the same results on all computers, and behaves like a
modulus in mathematics.
A logical one. For the last one higher classes
On Friday, 18 September 2020 at 23:00:33 UTC, Adam D. Ruppe wrote:
The error says something about constness being different, well,
why the eff would an init symbol ever be mutable?
See
https://forum.dlang.org/post/edngcvtlkjpykxvxy...@forum.dlang.org
for why TypeInfo is mutable. (In this
On Sunday, 9 August 2020 at 01:03:51 UTC, Bruce Carneal wrote:
The .alignof attribute of __vector(ubyte[32]) is 32 but
initializing an array of such vectors via an assignment to
.length has given me 16 byte alignment (and subsequent seg
faults which I suspect are related).
Is sub .alignof
On Saturday, 8 August 2020 at 17:00:17 UTC, Jeremiah Glover wrote:
I've been wanting to put together a programming to teach D. The
raspberry pi seemed like a good computer to use so everyone
could be guaranteed to have a computer to practice on. I've had
some trouble, however, getting a test
On Friday, 31 July 2020 at 10:22:20 UTC, Michael Reese wrote:
My question: Is there a way I can tell the D compiler to use
registers instead of stack for string arguments, or any other
trick to reduce code size while maintaining an ideomatic D
codestyle?
A D string is a "slice", which is a
On Monday, 20 July 2020 at 22:05:35 UTC, WhatMeWorry wrote:
1) The D Language Reference says:
"There are four kinds of arrays..." with the first example being
"type* Pointers to data" and "int* p; etc.
At the risk of sounding overly nitpicky, isn't a pointer to an
integer simply a
On Wednesday, 24 June 2020 at 18:53:34 UTC, matheus wrote:
Hi, I currently use D for small CLI/Batch apps, before that I
used to program in C.
Despite of using D I usually program like C but with the
advantage of: GC, AA, CTFE and a few classes here and there.
As we can see there are a lot
On Saturday, 20 June 2020 at 21:11:57 UTC, tastyminerals wrote:
I am not sure that this is a question about D or a more general
one. I have watched this nice presentation "Speed Is Found In
The Minds of People" by Andrei:
https://www.youtube.com/watch?v=FJJTYQYB1JQ=youtu.be?t=2596 and on 43:20
On Friday, 5 June 2020 at 22:36:23 UTC, data pulverizer wrote:
Hi,
I was switching from dmd to ldc2 and would like to know the
equivalent command line for conditional compilation
-version=Flag I was using in dmd. I checked the ldc2 --help but
didn't see anything relevant. Version there
On Sunday, 17 May 2020 at 03:30:57 UTC, Adnan wrote:
Hello, I am trying to examine what causes my similar D solution
to lag behind performance.
In the link, they don't have ldc or gdc but according to my
machine, the dmd generated code isn't really far behind ldc
generated code.
On Wednesday, 29 April 2020 at 13:02:36 UTC, Jan Hönig wrote:
On Wednesday, 29 April 2020 at 11:38:16 UTC, Johan wrote:
LDC is a (somewhat complex) project with D and C++ code (and
external C++ libraries).
I think it will help you if your main() is in D (such that
druntime is automatically
On Wednesday, 29 April 2020 at 10:25:31 UTC, Jan Hönig wrote:
In my pet project, I am using some C++ libraries. The main
file/function is also C++. All of it successfully compiles with
cmake. Now I want to add some functionality by calling my own D
functions (which use some other
On Thursday, 9 April 2020 at 20:42:18 UTC, Stefan Koch wrote:
Simple question, how do I keep the GC from spawning threads?
Cheers,
Stefan
https://dlang.org/changelog/2.087.0.html#gc_parallel
On Wednesday, 8 April 2020 at 15:52:59 UTC, Severin Teona wrote:
Hello,
I am working with a NUCLEO_f429zi board, architecure ARMv7e-m
and cortex-m4 CPU. I want to cross-compile D code for it from
Ubuntu 18.04 LTS Server. My current GCC version is 9.
How can I do that? What is the best
On Wednesday, 31 October 2018 at 23:14:08 UTC, Bastiaan Veelo
wrote:
Currently, BitArray is not usable at compile time, so you
cannot do
```
enum e = BitArray([1, 1, 1, 0]);
```
This gives
/dlang/dmd/linux/bin64/../../src/phobos/std/bitmanip.d(1190):
Error: `bts` cannot be interpreted at
On Friday, 3 April 2020 at 20:06:50 UTC, Steven Schveighoffer
wrote:
On 4/3/20 3:13 PM, Johan wrote:
On Thursday, 2 April 2020 at 12:41:28 UTC, Steven
Schveighoffer wrote:
Hm... I thought there was precedent for providing fallback
implementations for intrinsics. That is, you define the
On Thursday, 2 April 2020 at 12:41:28 UTC, Steven Schveighoffer
wrote:
On 4/2/20 8:26 AM, Bastiaan Veelo wrote:
On Thursday, 1 November 2018 at 08:50:38 UTC, Bastiaan Veelo
wrote:
On Thursday, 1 November 2018 at 00:01:04 UTC, Stefan Koch
wrote:
On Wednesday, 31 October 2018 at 23:14:08 UTC,
On Wednesday, 11 March 2020 at 22:18:04 UTC, kdevel wrote:
On Thursday, 27 February 2020 at 19:24:39 UTC, Johan wrote:
LDC will work fine if told what processor you have:
https://d.godbolt.org/z/5hrzgm
-m32 -mcpu=pentium3 (-mcpu=native should also work).
When I "cross compile" on an AMD 64
On Sunday, 8 March 2020 at 08:43:10 UTC, mark wrote:
Here are some timings ...
[...]
#!/usr/bin/env rdmd
Please remember that performance testing is not trivial.
At the very least, you should be testing optimized code (-O) and
preferably with LDC or GDC because they have a much stronger
On Thursday, 27 February 2020 at 18:07:40 UTC, Rainer Schuetze
wrote:
On 27/02/2020 11:30, kdevel wrote:
On Thursday, 27 February 2020 at 07:44:57 UTC, Seb wrote:
On Thursday, 27 February 2020 at 00:36:49 UTC, kdevel wrote:
[...]
Program received signal SIGILL, Illegal instruction.
On Wednesday, 26 February 2020 at 00:50:35 UTC, Basile B. wrote:
So after reading the translation of RYU I was interested too
see if the decimalLength() function can be written to be
faster, as it cascades up to 8 CMP.
...
Then bad surprise. Even with ldmd (so ldc2 basically) feeded
with
On Friday, 10 January 2020 at 00:02:52 UTC, Johan wrote:
For LDC:
```
double fma(double a, double b, double c)
{
import ldc.llvmasm;
return __irEx!(
`declare double @llvm.fma.f64(double %a, double
%b, double %c)`,
`%r = call double @llvm.fma.f64(double %0,
On Thursday, 9 January 2020 at 22:50:37 UTC, Ben Jones wrote:
On Thursday, 9 January 2020 at 20:57:10 UTC, Ben Jones wrote:
What's the easiest way to use the FMA instruction (fused
multiply add that has nice rounding properties)? The FMA
function in Phobos just does a*b +c which will round
On Wednesday, 23 October 2019 at 20:45:55 UTC, baz wrote:
On Tuesday, 22 October 2019 at 13:07:54 UTC, Andrey wrote:
On Tuesday, 22 October 2019 at 12:57:45 UTC, Daniel Kozak
wrote:
Have you try to clean all caches? Try to remove .dub folder
I removed .dub folder but this error appears
Hi all,
```
auto foo(const int[3] x)
{
int[3] y = x;
y[0] = 1; // line 4
return y;
}
immutable int[3] a = [0,1,2];
immutable int[3] b = foo(a); // line 8
```
compiles with an error:
```
4: Error: cannot modify read-only constant [0, 1, 2]
8:called from here:
On Wednesday, 9 August 2017 at 12:47:49 UTC, Steven Schveighoffer
wrote:
On 8/8/17 3:59 PM, Johan Engelen wrote:
In C++, it is clear that the _caller_ is doing the
dereferencing, and the dereference is also explicit.
In fact it's not doing any dereferencing. It's just under the
hood
Hi all,
What am I doing wrong here?
```
import std.algorithm;
int foo(char c) {
return 123;
}
auto mapFoo(char[] chars) {
return chars.map!(a => a.foo);
}
```
errors with:
main.d(14): Error: function main.foo (char c) is not callable
using argument types (dchar)
74 matches
Mail list logo