Re: Problem with GC - linking C++ & D (with gdc)

2022-04-26 Thread Iain Buclaw via Digitalmars-d-learn
On Tuesday, 26 April 2022 at 10:23:15 UTC, Claude wrote: Hello, Hello, <%--SNIP--%> Does anyone have any idea what's going on? (if I just compile a single D file with "int main() { int* a = new int(42); return *a; }", it works as intended.) The `new` keyword requests the druntime GC to

Re: Generate a pointer to a method of a struct

2022-10-14 Thread Iain Buclaw via Digitalmars-d-learn
On Friday, 14 October 2022 at 18:34:58 UTC, kdevel wrote: dmd and gdc optimize the lambda invocations away. Nonetheless the expression looks somewhat too big. To overcome this I tried to generate the function pointer outside of the struct: ``` auto funcptr (alias method) () { return &method

Re: Spec for the ‘locality’ parameter to the LDC and GDC builtin magic functions for accessing special CPU prefetch instructions

2023-08-20 Thread Iain Buclaw via Digitalmars-d-learn
On Saturday, 19 August 2023 at 19:23:38 UTC, Cecil Ward wrote: I’m trying to write a cross-platform function that gives access to the CPU’s prefetch instructions such as x86 prefetch0/1/2/prefetchnta and AAarch64 too. I’ve found that the GDC and LDC compilers provide builtin magic functions f

Re: real.sizeof

2024-02-05 Thread Iain Buclaw via Digitalmars-d-learn
On Monday, 5 February 2024 at 16:45:03 UTC, Dom DiSc wrote: Why is real.sizeof == 16 on x86-systems?!? Its the IEEE 754 extended format: 64bit mantissa + 15bit exponent + sign. It should be size 10! I mean, alignment may be different, but why wasting so much memory even in arrays? Padding.

Re: Porting D to custom OS

2020-02-22 Thread Iain Buclaw via Digitalmars-d-learn
On Saturday, 22 February 2020 at 13:20:40 UTC, IGotD- wrote: I'm trying to find information how to port D, especially the D runtime to a proprietary OS. The OS support seems to be scattered around several files with a lot version (OS) switches. This makes kind of hard to understand what you hav

Re: odd atomicOp errors from vibe-core

2020-04-12 Thread Iain Buclaw via Digitalmars-d-learn
On Friday, 10 April 2020 at 01:54:14 UTC, Steven Schveighoffer wrote: I'm building a library that uses vibe-core as an indirect dependency. Specifically, I'm testing the library with dub test. A very odd thing happens as I'm picking off compiler errors one at a time. After all the errors that

Re: Template error with gdc-10 but not with latest dmd and ldc

2020-07-26 Thread Iain Buclaw via Digitalmars-d-learn
On Sunday, 26 July 2020 at 19:27:13 UTC, rikki cattermole wrote: 2.066.0 to 2.078.1: Failure with output: onlineapp.d(7): Error: template instance add_long_n0!void does not match template declaration add_long_n0(alias T = void)(long x) 2.079.1 to 2.086.1: Failure with output: onlineapp.d(7): Err

Re: Lack of asm volatile qualifier (explicitly) again.

2020-07-30 Thread Iain Buclaw via Digitalmars-d-learn
On Tuesday, 28 July 2020 at 06:57:36 UTC, Cecil Ward wrote: I read recently that all asm in D is regarded as ‘volatile’ in the GCC sense, which I take to mean that it is assume to potentially have side effects, and so cannot be optimised away to nothing by the compiler despite the lack of any o

Re: Lack of asm volatile qualifier (explicitly) again.

2020-08-01 Thread Iain Buclaw via Digitalmars-d-learn
On Saturday, 1 August 2020 at 02:36:41 UTC, Cecil Ward wrote: On Thursday, 30 July 2020 at 07:05:39 UTC, Iain Buclaw wrote: [...] Ah. I wasn’t thinking about pure, although I do use it everywhere I can as a matter of course. The absence of something doesn’t hit you in the eye as an expressio

Re: Debugging D code with GDB

2021-11-28 Thread Iain Buclaw via Digitalmars-d-learn
On Saturday, 27 November 2021 at 14:17:11 UTC, Eduard Staniloiu wrote: Hello, I'm trying to use `gdb` to debug D binaries, but I'm having trouble accessing the methods of a struct or class. It seems that `gdb` doesn't see them. Given the following simple example ``` // test.d struct S {

Re: Debugging D code with GDB

2021-11-30 Thread Iain Buclaw via Digitalmars-d-learn
On Monday, 29 November 2021 at 14:48:21 UTC, Luís Ferreira wrote: On Sun, 2021-11-28 at 21:59 +, Iain Buclaw via Digitalmars-d-learn wrote: DMD doesn't emit this information. GDB can't work miracles when the compiler isn't pulling its own weight. I confirm this is an is

Re: gdc or ldc for faster programs?

2022-01-26 Thread Iain Buclaw via Digitalmars-d-learn
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 system: >> >> ldc: LDC - the LLVM D compiler (1.28.0): >> based on D

Re: gdc or ldc for faster programs?

2022-01-26 Thread Iain Buclaw via Digitalmars-d-learn
On Wednesday, 26 January 2022 at 11:43:39 UTC, forkit wrote: On Wednesday, 26 January 2022 at 11:25:47 UTC, Iain Buclaw wrote: Whenever I've watched talks/demos where benchmarks were the central topic, GDC has always blown LDC out the water when it comes to matters of math. .. https://dlan

Re: gdc or ldc for faster programs?

2022-01-26 Thread Iain Buclaw via Digitalmars-d-learn
On Wednesday, 26 January 2022 at 18:39:07 UTC, Siarhei Siamashka wrote: It's not DMD doing a good job here, but GDC11 shooting itself in the foot by requiring additional esoteric command line options if you really want to produce optimized binaries. The D language shot itself in the foot by

Re: gdc or ldc for faster programs?

2022-01-28 Thread Iain Buclaw via Digitalmars-d-learn
On Thursday, 27 January 2022 at 20:28:40 UTC, Siarhei Siamashka wrote: On Thursday, 27 January 2022 at 18:12:18 UTC, Johan Engelen wrote: But the language requires ODR, so we can emit templates as weak_odr, telling the optimizer and linker that the symbols should be merged _and_ that ODR can be

Re: gdc or ldc for faster programs?

2022-03-09 Thread Iain Buclaw via Digitalmars-d-learn
On Monday, 31 January 2022 at 10:33:49 UTC, Siarhei Siamashka wrote: I wonder if GDC can do the same? GDC as a front-end doesn't dictate what the optimization passes are doing, nor does it have any real control what each level means. It is only ensured that semantic doesn't break because of

Re: GCC 4.9.4 + GDC-patch: internal compiler error in libphobos/src/std/math.d:8040:47

2019-01-06 Thread Iain Buclaw via Digitalmars-d-learn
On Saturday, 5 January 2019 at 22:27:49 UTC, kdevel wrote: I applied the head commit ce249d880969111384d17f744687e427c843f1d4 Merge: 8a6b7a4 0e517e4 Author: Eugene Wissner Date: Tue Apr 10 15:37:32 2018 +0200 Merge pull request #647 from belka-ew/gdc-49up Merge bra

Re: union alignment

2016-05-21 Thread Iain Buclaw via Digitalmars-d-learn
On Wednesday, 18 May 2016 at 01:46:37 UTC, tsbockman wrote: Shouldn't a union type always have an `alignof` at least as great as the `alignof` for its largest member? On x86, there's a difference between the type alignment and the field alignment. The type align of ulong and double are 8 b

Re: Method signature differences in core modules on dmd and gdc?

2014-10-12 Thread Iain Buclaw via Digitalmars-d-learn
On Sunday, 12 October 2014 at 19:20:49 UTC, Gary Willoughby wrote: I've been recently trying GDC out to compile some D code and i'm running into the problem of differing function signatures in core modules. For example: stack.d:79: error: function core.memory.GC.calloc (ulong sz, uint ba = 0

Re: fromStringz problem with gdc

2015-04-06 Thread Iain Buclaw via Digitalmars-d-learn
On Monday, 6 April 2015 at 17:47:27 UTC, chardetm wrote: Hello everyone, I have a problem with the fromStringz function (std.string.fromStringz) when I try to compile with the GDC compiler (it works fine with DMD). Here is a minimal code to see the error: import std.stdio, std.string, std.

Re: Alignment of struct containing SIMD field - GDC

2017-03-01 Thread Iain Buclaw via Digitalmars-d-learn
On Wednesday, 1 March 2017 at 06:04:32 UTC, Cecil Ward wrote: struct vec_struct { alias field this; bool b; int8 field; } In this code when you look at the generated x64 code output by GDC it seems to be doing a nice job, because it has got the offset right for the 256-bit YMM

Re: Alignment of struct containing SIMD field - GDC

2017-03-01 Thread Iain Buclaw via Digitalmars-d-learn
On Wednesday, 1 March 2017 at 19:09:24 UTC, Johan Engelen wrote: On Wednesday, 1 March 2017 at 18:34:16 UTC, Iain Buclaw wrote: Simple test case would be: struct vec_struct { bool b2; struct { bool b; int8 field; } } static assert(vec_struct.b.offsetof == 32); stat