On Wednesday, 24 April 2024 at 19:50:45 UTC, Chris Piker wrote:
is anyone aware of any tools that generate an abstract syntax
tree which could then be converted to somewhat equivalent D
code? This might give me a jump-start on the manual conversion
process. Then later I can work on removing
On Wednesday, 1 May 2024 at 01:09:33 UTC, Liam McGillivray wrote:
This is presumably such a common task that I'm surprised it
isn't easy to find the answer by searching;
Is there a standard library function that removes all elements
from a dynamic array that matches an input argument?
In `st
On Wednesday, 1 May 2024 at 15:18:03 UTC, Steven Schveighoffer
wrote:
On Wednesday, 1 May 2024 at 01:09:33 UTC, Liam McGillivray
wrote:
This is presumably such a common task that I'm surprised it
isn't easy to find the answer by searching;
Is there a standard library function that removes all
On Saturday, 11 May 2024 at 19:33:03 UTC, solidstate1991 wrote:
I know that BindBC exists and otherwise would use it, but the
bigger the library, the more extra hurdle it'll have. When I
did a few bindings with it, I had to order the functions the
right way, so I could do things much quicker wi
On Saturday, 11 May 2024 at 20:04:38 UTC, Lance Bachmeier wrote:
On Saturday, 11 May 2024 at 19:33:03 UTC, solidstate1991 wrote:
I know that BindBC exists and otherwise would use it, but the
bigger the library, the more extra hurdle it'll have. When I
did a few bindings with it, I had to order
On Wednesday, 12 June 2024 at 21:36:30 UTC, Dukc wrote:
bachmeier kirjoitti 12.6.2024 klo 18.21:
You're splitting things into GC-allocated memory and manually
managed memory. There's also SafeRefCounted, which handles the
malloc and free for you.
I suspect `SafeRefCounted` (or `RefCounted`) i
On Wednesday, 12 June 2024 at 21:59:54 UTC, drug007 wrote:
Yes, but you get all the benefits of `double[]` for free if
you do it that way, including the more concise foo[10] syntax.
I meant you do not need to add `ptr` field at all
I see. You're right. I thought it would be easier for someon
On Thursday, 13 June 2024 at 07:18:48 UTC, Dukc wrote:
Lance Bachmeier kirjoitti 13.6.2024 klo 1.32:
Why would it be different from calling malloc and free
manually? I guess I'm not understanding, because you put the
same calls to malloc and free that you'd otherwise be doing
inside this and
On Saturday, 22 June 2024 at 10:47:42 UTC, bachmeier wrote:
I don't normally use Dub for this reason (it takes longer for
me to figure out how to create the dub.json than it's worth).
I'd expect "dflags" to work, but I haven't tried, and I'm not
sure how much of ImportC even works with GDC.
On Wednesday, 3 July 2024 at 03:52:41 UTC, Steven Schveighoffer
wrote:
```d
mixin template implement()
{
mixin(() {
// ctfe new array is basically the same as static array
char[] buffer = new char[4096];
int pos = 0;
void append(string str)
{
On Tuesday, 9 July 2024 at 07:54:12 UTC, kiboshimo wrote:
If you haven't done so, I'd recommend reading the blog posts from
Walter to get an understanding of why BetterC was introduced and
how to use it: https://dlang.org/blog/category/betterc/
- betterC does not need glue code to interop wit
On Friday, 19 July 2024 at 09:34:13 UTC, Lewis wrote:
```
string[3][string] lookup;
string[] dynArray = ["d", "e", "f"];
lookup["test"] = dynArray[0..$];
```
This fails at runtime with RangeError. But if I change that
last line to:
```
lookup["test"] = dynArray[0..3];
```
then it works. But
On Thursday, 1 August 2024 at 07:25:53 UTC, Emma wrote:
but this doesn't:
```d
Option!int something() {
return None(); // Error: cannot implicitly convert expression
`None()` of type `None` to `Option!int`
}
```
For the program you've written, I'm happy it doesn't compile,
because a lot
On Sunday, 11 August 2024 at 06:04:08 UTC, mw wrote:
On Thursday, 5 February 2015 at 14:09:10 UTC, bearophile wrote:
Tobias Pankrath:
Works as designed:
http://dlang.org/phobos/std_algorithm.html#.remove
Unfortunately it's one of the worst designed functions of
Phobos:
https://issues.dlang
On Saturday, 17 August 2024 at 05:28:37 UTC, Bruce wrote:
This seems to work but now I'm concerned.
Why was it so hard to find?
What is the best way to search for a function
in the Phobos library?
Browsing the Phobos index will often do the trick, as will
searching in the forum using the box
On Friday, 30 August 2024 at 04:49:48 UTC, Dakota wrote:
get this error:
```sh
In file included from /llvm/lib/clang/18/include/stddef.h:77,
from /usr/include/time.h:29,
from /llvm/include/clang-c/CXFile.h:17,
from
/llvm/include/clang-c/CXSour
On Saturday, 31 August 2024 at 15:38:49 UTC, ryuukk_ wrote:
Let's see how other languages do it:
```zig
map.put("hello", 42);
// get pointer
if (map.get("hello")) |*it| {
std.log.debug("{}", .{it});
}
// get value
if (map.get("hello")) |it| {
std.log.deb
On Monday, 8 January 2024 at 18:53:47 UTC, Renato wrote:
Is it possible to use C header-only libs from D?
In C, I would need to do this:
```c
#define STB_DS_IMPLEMENTATION
#include "stb_ds.h"
```
The definition must be done in a single C file before including
the h file.
I tried this in D:
On Saturday, 10 February 2024 at 15:53:09 UTC, Alexander Zhirov
wrote:
Is it possible to calculate the difference between dates in
years using regular means? Something like that
```
writeln(Date(1999, 3, 1).diffMonths(Date(1999, 1, 1)));
```
At the same time, keep in mind that the month and d
On Saturday, 10 February 2024 at 21:56:30 UTC, Lance Bachmeier
wrote:
On Saturday, 10 February 2024 at 15:53:09 UTC, Alexander Zhirov
wrote:
Is it possible to calculate the difference between dates in
years using regular means? Something like that
```
writeln(Date(1999, 3, 1).diffMonths(Date(
On Sunday, 24 March 2024 at 19:31:19 UTC, Csaba wrote:
I know that benchmarks are always controversial and depend on a
lot of factors. So far, I read that D performs very well in
benchmarks, as well, if not better, as C.
I wrote a little program that approximates PI using the Leibniz
formula.
On Tuesday, 26 March 2024 at 14:25:53 UTC, Lance Bachmeier wrote:
On Sunday, 24 March 2024 at 19:31:19 UTC, Csaba wrote:
I know that benchmarks are always controversial and depend on
a lot of factors. So far, I read that D performs very well in
benchmarks, as well, if not better, as C.
I wrot
On Saturday, 30 March 2024 at 05:01:32 UTC, harakim wrote:
On Tuesday, 26 March 2024 at 20:42:00 UTC, Chris Piker wrote:
On Tuesday, 26 March 2024 at 20:19:27 UTC, bachmeier wrote:
Should be able to just use it, as described here:
https://forum.dlang.org/post/qxctappnigkwvaqak...@forum.dlang.
On Wednesday, 3 April 2024 at 21:57:00 UTC, Liam McGillivray
wrote:
Alright. I suppose that some of the optimization decisions I
have made so far may have resulted in less readable code for
little performance benefit. Now I'm trying to worry less about
optimization. Everything has been very f
On Friday, 12 April 2024 at 18:45:21 UTC, Chris Piker wrote:
Even though DMD can't compile some C code, that's pretty much a
non-issue for me anyway. In my environment the servers are all
Linux so "apt-get" (or equivalent) typically provides a
pre-compiled dependency. Being able to list a pa
On Friday, 12 April 2024 at 18:36:13 UTC, Chris Piker wrote:
On Saturday, 30 March 2024 at 07:11:49 UTC, Mike Parker wrote:
Though I appreciate the sentiment, it's much more effective
and efficient for people actually using the feature, and who
appreciate it, to write up a blog post about it so
On Tuesday, 8 October 2024 at 18:24:50 UTC, germandiago wrote:
What I do not agree with is your tone. I am noone here, but I
think it is not good to tolerate this level. It sets a bad
precedent.
Just my 2 cents.
This has come up many times before. The powers that be have been
clear that th
On Tuesday, 15 October 2024 at 13:30:03 UTC, Mark Bauermeister
wrote:
On Tuesday, 15 October 2024 at 12:27:42 UTC, barbosso wrote:
Are you heard of https://github.com/dkorpel/ctod ?
I actually used CTOD for part of the translation but it
wouldn't translate the macros correctly. It turned them
On Tuesday, 29 October 2024 at 12:23:06 UTC, DLearner wrote:
However, there is still a problem:
```
dmd hello.c
C:\D\dmd2\windows\bin64\..\..\src\druntime\import\importc.h(134): fatal error
C1034: sal.h: no include path set
Error: C preprocess command cl.exe failed for file hello.c,
exit statu
On Tuesday, 29 October 2024 at 16:14:22 UTC, DLearner wrote:
On Tuesday, 29 October 2024 at 15:49:13 UTC, ryuukk_ wrote:
On Tuesday, 29 October 2024 at 15:14:24 UTC, DLearner wrote:
On Tuesday, 29 October 2024 at 12:42:49 UTC, Lance Bachmeier
wrote:
On Tuesday, 29 October 2024 at 12:23:06 UTC,
On Tuesday, 29 October 2024 at 18:17:37 UTC, Richard (Rikki)
Andrew Cattermole wrote:
https://issues.dlang.org/show_bug.cgi?id=24308
I guess that explains why I've never run into the issue - I've
been using LDC but not DMD on Windows.
On Tuesday, 5 November 2024 at 17:32:00 UTC, Andy Valencia wrote:
I have a template which has a bit where it negates a value.
This works well until it encountered a short, where ldc2
complained:
integral promotion not done for -val
My reading of the spec is that this should be legal:
https
On Thursday, 17 October 2024 at 07:38:30 UTC, Serg Gini wrote:
On Wednesday, 16 October 2024 at 23:54:45 UTC, Danico wrote:
Hola gente les comparto aqui los descubrimientos en Dlang que
Hola amigo
Porfavor
And this is all I know in Spanish :)
But I’ve translated in your GitHub profile that y
On Thursday, 30 January 2025 at 01:38:07 UTC, Kyle Ingraham wrote:
Does D have a 'try' `std.conv:to` that does not throw if it
fails?
Have you looked at
[mir.conv](http://mir-core.libmir.org/mir_conv.html) and
[mir.parse](http://mir-algorithm.libmir.org/mir_parse.html)?
On Friday, 20 December 2024 at 16:35:39 UTC, bauss wrote:
On Friday, 20 December 2024 at 16:27:48 UTC, Duke wrote:
Ali's book
http://ddili.org/ders/d.en/
I recommend using that book and playing around with the examples
[in the online D editor](https://run.dlang.io/). Note also that
the
On Tuesday, 28 January 2025 at 13:01:56 UTC, DLearner wrote:
Is there a definitive list somewhere of standard library
functions that work with -betterC?
For example, the following code fragment (taken from the
library docs) does not work with -betterC.
```
extern(C) void main() {
import st
On Monday, 13 January 2025 at 11:36:45 UTC, Dakota wrote:
I want tranlate this into d without importC, what is the best
way to do it?
When you say "without importC" do you mean without compiling it
using importC? Because if you're able to use importC for just the
translation, you can put the
On Friday, 21 February 2025 at 15:48:12 UTC, Steven Schveighoffer
wrote:
But testing this, it doesn't make sense:
```d
uint x = long(-1); // OK
uint y = -1L; // Error: cannot implicitly convert expression
`-1L` of type `long` to `uint`
```
Surely something here is worthy of a bug report
On Thursday, 20 February 2025 at 20:09:29 UTC, Ian wrote:
Hi,
What is the recommended documentation or introductory material
on how to call C libraries from D? I've seen it done in GtkD
(for GTK3) and I have heard of -betterC, but it's all a little
overwhelming. (I'm an experienced C programm
On Monday, 23 June 2025 at 10:14:25 UTC, Jonathan M Davis wrote:
D has done a number of things with overloaded operators to try
to minimize the ability to do what many consider to be
overloaded operator abuse (e.g. using using overloaded
operators to define a DSL - or really much of anything t
On Saturday, 28 June 2025 at 15:20:44 UTC, WraithGlade wrote:
There are very few imposed structural "best practices" that are
genuinely universal in my experience. Good naming of variables
would be a rare example of a universally good practice, in my
opinion, but in contrast even pervasive and
On Friday, 27 June 2025 at 19:55:30 UTC, WraithGlade wrote:
Thanks for responding to my question and for your time, etc.
I was aware of `align` but as far as I am aware it is
orthogonal to what I'm asking about. The Andrei book says that
D automatically rearranges members of `class`s in memory
42 matches
Mail list logo