On Fri, Jul 19, 2024 at 05:48:37PM +, Dennis via Digitalmars-d-learn wrote:
> On Friday, 19 July 2024 at 17:20:22 UTC, matheus wrote:
> > couldn't this case for example be caught during the compiling time?
>
> The RangeError is only thrown when at runtime, the key doesn't exist,
> so that can'
On Fri, Jul 19, 2024 at 09:34:13AM +, Lewis via Digitalmars-d-learn 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"] =
On Tue, Jul 09, 2024 at 08:03:15PM +, kiboshimo via Digitalmars-d-learn
wrote:
> On Tuesday, 9 July 2024 at 14:42:01 UTC, monkyyy wrote:
> > On Tuesday, 9 July 2024 at 07:54:12 UTC, kiboshimo wrote:
[...]
> > > Really liked the idea of doing it with betterC to start my systems
> > > programmin
On Sun, Jul 07, 2024 at 02:41:31PM +, Andrey Zherikov via
Digitalmars-d-learn wrote:
> Seems different functions in std.path do not work together:
> ```d
> import std.path;
>
> // Error: no property `asNormaliedPath` for
> `dirName("/sandbox/onlineapp.d")` of type `string`
> auto p = __FILE_F
On Thu, Jun 27, 2024 at 10:14:06PM +, WhatMeWorry via Digitalmars-d-learn
wrote:
> Thanks, that did the trick. Not sure why having the declarations at
> global scope (or is it module scope in D) would work versus having
> them at local scope?
If you stuck 'static' to the local scope declarati
On Thu, Jun 27, 2024 at 08:56:13PM +, WhatMeWorry` via Digitalmars-d-learn
wrote:
> import std.container : RedBlackTree;
>
> int main()
> {
>
> struct Location {
> int x;
> int y;
> }
>
> struct Node{
> this(Location loc, uint f) {
> this.loc
On Tue, Jun 18, 2024 at 11:07:47PM +, Murilo via Digitalmars-d-learn wrote:
> I've created a software which performs the Fermat's Primality Test,
> however if I input a very big number it causes an error saying
> "Illegal instruction (core dumped)". Does anyone know why?
>
> I've used GDB and
On Thu, Jun 06, 2024 at 05:49:39PM +, Andy Valencia via Digitalmars-d-learn
wrote:
> I was using instance initialization which allocated a new object. My
> intention was this initialization would happen per-instance, but all
> instances appear to share the same sub-object? That is, f1.b and
On Wed, Apr 24, 2024 at 08:08:06AM +, Menjanahary R. R. via
Digitalmars-d-learn wrote:
> I tried to solve Project Euler [problem
> #2](https://projecteuler.net/problem=2) using
> [Recurrence/recurrence](https://dlang.org/library/std/range/recurrence.html).
>
> Assuming `genEvenFibonacci` is t
On Wed, Apr 03, 2024 at 09:57:00PM +, Liam McGillivray via
Digitalmars-d-learn wrote:
> On Friday, 29 March 2024 at 01:18:22 UTC, H. S. Teoh wrote:
> > Take a look at the docs for core.memory.GC. There *is* a method
> > GC.free that you can use to manually deallocate GC-allocated memory
> > i
On Fri, Apr 05, 2024 at 03:18:09PM +, Salih Dincer via Digitalmars-d-learn
wrote:
> Hi everyone,
>
> Technically r1 and r2 are different types of range. Isn't it
> inconsistent to chain both? If not, why is the char type converted to
> int?
[...]
It's not inconsistent if there exists a commo
On Thu, Mar 28, 2024 at 11:49:19PM +, Liam McGillivray via
Digitalmars-d-learn wrote:
> On Thursday, 28 March 2024 at 04:46:27 UTC, H. S. Teoh wrote:
> > The whole point of a GC is that you leave everything up to it to
> > clean up. If you want to manage your own memory, don't use the GC.
> >
On Thu, Mar 28, 2024 at 10:10:43PM +, jms via Digitalmars-d-learn wrote:
> On Thursday, 28 March 2024 at 02:30:11 UTC, jms wrote:
[...]
> I think I figured it out and the difference is probably in the mode.
> This documentation
> https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference
On Thu, Mar 28, 2024 at 05:23:39PM +, Andy Valencia via Digitalmars-d-learn
wrote:
[...]
> auto t = T();
> foreach (i, ref val; t.tupleof) {
> static if (is(typeof(val) == int)) {
> val = this.get_int();
> } else {
> val = this.get_str();
>
On Thu, Mar 28, 2024 at 03:56:10AM +, Liam McGillivray via
Digitalmars-d-learn wrote:
[...]
> I may be now starting to see why the use of a garbage collector is
> such a point of contention for D. Not being able to predict how the
> garbage collection process will happen seems like a major pro
On Wed, Mar 27, 2024 at 09:43:48PM +, Liam McGillivray via
Digitalmars-d-learn wrote:
[...]
> ```
> ~this() {
> this.alive = false;
> if (this.map !is null) this.map.removeUnit(this);
> if (this.faction !is null) this.faction.removeUnit(this);
> if (this.cur
On Sat, Mar 16, 2024 at 09:16:51PM +, Liam McGillivray via
Digitalmars-d-learn wrote:
> On Friday, 15 March 2024 at 00:21:42 UTC, H. S. Teoh wrote:
[...]
> > When dealing with units of data smaller than a byte, you generally
> > need to do it manually, because memory is not addressable by
> >
On Thu, Mar 14, 2024 at 11:39:33PM +, Liam McGillivray via
Digitalmars-d-learn wrote:
[...]
> I tried to rework the functions to use bitwise operations, but it was
> difficult to figure out the correct logic. I decided that it's not
> worth the hassle, so I just changed the value storage from
On Thu, Mar 14, 2024 at 08:58:21PM +, Andy Valencia via Digitalmars-d-learn
wrote:
> On Thursday, 14 March 2024 at 18:05:59 UTC, H. S. Teoh wrote:
> > ...
> > The best way to do multi-type varags in D is to use templates:
> >
> > import std;
> > void myFunc(Args...)(Args args) {
>
>
On Thu, Mar 14, 2024 at 05:57:21PM +, Andy Valencia via Digitalmars-d-learn
wrote:
> Can somebody give me a starting point for understanding varadic
> functions? I know that we can declare them
>
> int[] args...
>
> and pick through whatever the caller provided. But if the caller
> wants
On Wed, Mar 06, 2024 at 11:39:13PM +, Carl Sturtivant via
Digitalmars-d-learn wrote:
> I notice that a class with no data members has a size of two words (at
> 64 bits). Presumably there's a pointer to a table of virtual
> functions, and one more. Is the Vtable first?
[...]
> What is actually
On Wed, Feb 28, 2024 at 03:00:55AM +, Liam McGillivray via
Digitalmars-d-learn wrote:
> In D, it appears that dynamic arrays (at least by default) use a ulong
> as their key type. They are declared like this:
> ```
> string[] dynamicArray;
> ```
>
> I imagine that using a 64-bit value as the
On Thu, Feb 15, 2024 at 02:17:15AM +, Basile B. via Digitalmars-d-learn
wrote:
> From what I remember, it was that there was no reference to the
> source. Things got blitted and you had to fix the copy, already
> blitted. Was that the only issue ?
I don't quite remember all of the reasons no
On Tue, Feb 13, 2024 at 06:36:22PM +, Nick Treleaven via
Digitalmars-d-learn wrote:
> On Monday, 12 February 2024 at 18:22:46 UTC, H. S. Teoh wrote:
[...]
> > Honestly, I think this issue is blown completely out of proportion.
> > The length of stuff in any language needs to be some type. D de
On Mon, Feb 12, 2024 at 07:34:36PM +, bachmeier via Digitalmars-d-learn
wrote:
> On Monday, 12 February 2024 at 18:22:46 UTC, H. S. Teoh wrote:
>
> > Honestly, I think this issue is blown completely out of proportion.
>
> Only for people that don't have to deal with the problems it causes.
On Mon, Feb 12, 2024 at 05:26:25PM +, Nick Treleaven via
Digitalmars-d-learn wrote:
> On Friday, 9 February 2024 at 15:19:32 UTC, bachmeier wrote:
> > It's been discussed many, many times. The behavior is not going to
> > change - there won't even be a compiler warning. (You'll have to
> > che
On Sat, Feb 10, 2024 at 03:53:09PM +, Alexander Zhirov via
Digitalmars-d-learn 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
On Thu, Feb 08, 2024 at 06:22:29PM +, Carl Sturtivant via
Digitalmars-d-learn wrote:
> On Wednesday, 7 February 2024 at 17:11:30 UTC, H. S. Teoh wrote:
> > Do we know why the compiler isn't getting it right? Shouldn't we be
> > fixing it instead of just turning off elision completely?
>
> Th
On Thu, Feb 08, 2024 at 05:44:59AM +1300, Richard (Rikki) Andrew Cattermole via
Digitalmars-d-learn wrote:
> On 08/02/2024 5:36 AM, Carl Sturtivant wrote:
[...]
> > ```
> > $ dmd --help | grep allinst
> > -allinst generate code for all template instantiations
> > ```
> > Unclear exactl
On Sat, Jan 20, 2024 at 02:33:24PM +, atzensepp via Digitalmars-d-learn
wrote:
> Hello,
>
> I am new with D and want to convert a c program for a csv file manipulation
> with exhaustive dynamic memory mechanics to D .
>
> When reading a CSV-file line by line I would like to create an associa
On Sat, Jan 20, 2024 at 01:35:44AM +0100, Daniel Kozak via Digitalmars-d-learn
wrote:
[...]
>> Try addressing the points I wrote above and see if it makes a
>> difference.
>
>I have tried it (all of it) even before you wrote it here, because
>I have completely the same ideas, but
On Fri, Jan 19, 2024 at 01:40:39PM +, Renato via Digitalmars-d-learn wrote:
> On Friday, 19 January 2024 at 10:15:57 UTC, evilrat wrote:
[...]
> > Additionally if you comparing D by measuring DMD performance -
> > don't. It is valuable in developing for fast iterations, but it
> > lacks many m
On Thu, Jan 18, 2024 at 04:23:16PM +, Renato via Digitalmars-d-learn wrote:
[...]
> Ok, last time I'm running this for someone else :D
>
> ```
> Proc,Run,Memory(bytes),Time(ms)
> ===> ./rust
> ./rust,23920640,30
> ./rust,24018944,147
> ./rust,24068096,592
> ./rust,24150016,1187
> ./rust,776601
On Thu, Jan 18, 2024 at 11:58:32PM +, zoujiaqing via Digitalmars-d-learn
wrote:
> On Thursday, 18 January 2024 at 23:43:13 UTC, Jonathan M Davis wrote:
> > On Thursday, January 18, 2024 4:26:42 PM MST zoujiaqing via
> > Digitalmars-d- learn wrote:
> > > ```D
> > > import std.datetime : Clock,
On Wed, Jan 17, 2024 at 07:57:02AM -0800, H. S. Teoh via Digitalmars-d-learn
wrote:
[...]
> I'll push the code to github.
[...]
Here: https://github.com/quickfur/prechelt/blob/master/encode_phone.d
T
--
Why do conspiracy theories always come from the same people??
On Wed, Jan 17, 2024 at 07:19:39AM +, Renato via Digitalmars-d-learn wrote:
[...]
> But pls run the benchmarks yourself as I am not going to keep running
> it for you, and would be nice if you posted your solution on a Gist
> for example, pasting lots of code in the forum makes it difficult to
On Wed, Jan 17, 2024 at 07:19:39AM +, Renato via Digitalmars-d-learn wrote:
> On Tuesday, 16 January 2024 at 22:13:55 UTC, H. S. Teoh wrote:
> > used for the recursive calls. Getting rid of the .format ought to
> > speed it up a bit. Will try that now...
> >
>
> That will make no difference f
On Tue, Jan 16, 2024 at 10:15:04PM +, Siarhei Siamashka via
Digitalmars-d-learn wrote:
> On Tuesday, 16 January 2024 at 21:15:19 UTC, Renato wrote:
[...]
> > ... what I am really curious about is what the code I wrote is doing
> > wrong that causes it to run 4x slower than Rust despite doing "
On Tue, Jan 16, 2024 at 09:15:19PM +, Renato via Digitalmars-d-learn wrote:
> On Tuesday, 16 January 2024 at 20:34:48 UTC, H. S. Teoh wrote:
> > On Tue, Jan 16, 2024 at 12:28:49PM -0800, H. S. Teoh via
> > Digitalmars-d-learn wrote: [...]
> > > Anyway, I've fixe
On Tue, Jan 16, 2024 at 12:28:49PM -0800, H. S. Teoh via Digitalmars-d-learn
wrote:
[...]
> Anyway, I've fixed the problem, now my program produces the exact same
> output as Renato's repo. Code is posted below.
[...]
Oops, forgot to actually paste the
On Tue, Jan 16, 2024 at 06:54:56PM +, Renato via Digitalmars-d-learn wrote:
> On Tuesday, 16 January 2024 at 16:56:04 UTC, Siarhei Siamashka wrote:
[...]
> > You are not allowed to emit "1" as the first token in the output as
> > long as there are any dictionary word matches at that position. T
P.S. Compiling my program with `ldc -O2`, it runs so fast that I
couldn't measure any meaningful running time that's greater than startup
overhead. So I wrote a helper program to generate random phone numbers
up to 50 characters long, and found that it could encode 1 million phone
numbers in 2.2 s
On Tue, Jan 16, 2024 at 07:50:35AM -0800, H. S. Teoh via Digitalmars-d-learn
wrote:
[...]
> Unfortunately there seems to be some discrepancy between the output I
> got and the prescribed output in your repository. For example, in your
> output the number 1556/0 does not have an enco
On Mon, Jan 15, 2024 at 08:10:55PM +, Renato via Digitalmars-d-learn wrote:
> On Monday, 15 January 2024 at 01:10:14 UTC, Sergey wrote:
> > On Sunday, 14 January 2024 at 17:11:27 UTC, Renato wrote:
> > > If anyone can find any flaw in my methodology or optmise my code so
> > > that it can still
On Mon, Jan 15, 2024 at 06:16:44PM +, Bastiaan Veelo via
Digitalmars-d-learn wrote:
> Hey people, I can use some help understanding why the last line
> produces a compile error.
>
> ```d
> import std.stdio;
>
> struct S
> {
> static void foo(alias len)()
[...]
The trouble is with the `s
On Mon, Jan 08, 2024 at 05:28:50PM +, matheus via Digitalmars-d-learn wrote:
> Hi,
>
> I was doing some tests and this code:
>
> import std;
>
> struct S{
> string[] s = ["ABC"];
> int i = 123;
> }
[...]
It's not recommended to use initializers to initialize mutable
array-valued mem
On Fri, Jan 05, 2024 at 08:41:53PM +, Noé Falzon via Digitalmars-d-learn
wrote:
> On the subject of `map` taking the function as template parameter, I
> was surprised to see it could still be used with functions determined
> at runtime, even closures, etc. I am trying to understand the
> mecha
On Wed, Jan 03, 2024 at 04:50:57PM +, axricard via Digitalmars-d-learn
wrote:
> I have an interface that is implemented by many classes, and I want to
> pick one of these implementations at random. There are two more
> constraints : first the distribution is not uniform, all classes can
> defi
On Fri, Dec 22, 2023 at 09:40:03PM +, bomat via Digitalmars-d-learn wrote:
> On Friday, 22 December 2023 at 16:51:11 UTC, bachmeier wrote:
> > Given how fast computers are today, the folks that focus on memory
> > and optimizing for performance might want to apply for jobs as
> > flooring inspe
On Fri, Dec 22, 2023 at 07:22:15PM +, Dmitry Ponyatov via
Digitalmars-d-learn wrote:
> > It's called GC phobia, a knee-jerk reaction malady common among
> > C/C++ programmers
>
> I'd like to use D in hard realtime apps (gaming can be thought as one
> of them, but I mostly mean realtime dynami
On Mon, Dec 18, 2023 at 04:44:11PM +, Bkoie via Digitalmars-d-learn wrote:
[...]
> but what is with these ppl and the gc?
[...]
It's called GC phobia, a knee-jerk reaction malady common among C/C++
programmers (I'm one of them, though I got cured of GC phobia thanks to
D :-P). 95% of the time
On Wed, Dec 13, 2023 at 11:58:42AM -0800, H. S. Teoh via Digitalmars-d-learn
wrote:
[...]
> Add a module declaration to your source file. For example:
>
> echo 'module abc; import std; void main(){writefln(__MODULE__);}' | dmd
> -run -
>
> Output:
>
On Wed, Dec 13, 2023 at 07:37:09PM +, Siarhei Siamashka via
Digitalmars-d-learn wrote:
> Example:
>
> ```D
> import std;
> void main() {
> deliberate syntax error here
> }
> ```
>
> ```bash
> $ cat example.d | dmd -run -
> __stdin.d(3): Error: found `error` when expecting `;` or `=`, did y
On Wed, Dec 06, 2023 at 04:24:51AM +0900, confuzzled via Digitalmars-d-learn
wrote:
[...]
> import std.stdio;
> void main()
> {
> F fp;
> fp.lo.writeln; // Why is this not zero? How is this value derived?
> fp.hi.writeln; // expected
> fp.x.writeln; // expected
>
> fp.x =
>
On Mon, Dec 04, 2023 at 11:46:45PM +, DLearner via Digitalmars-d-learn
wrote:
[...]
> Basically, B corresponds to the whole record (and only a whole record
> can be read).
> But the task only requires Var1 and Var2, the last two fields on the record.
> By putting all the irrelevant fields into
On Thu, Nov 23, 2023 at 07:22:22PM +, BoQsc via Digitalmars-d-learn wrote:
> Is it possible to declare empty pointer variable inside function calls
> and pass its address to the function?
>
> These are sometimes required while using Win32 - Windows Operating
> System API.
>
> * Empty pointer
On Fri, Nov 03, 2023 at 12:19:48AM +, Andrey Zherikov via
Digitalmars-d-learn wrote:
> On Thursday, 2 November 2023 at 19:43:01 UTC, Adam D Ruppe wrote:
> > On Thursday, 2 November 2023 at 19:30:58 UTC, Jonathan M Davis wrote:
> > > The entire reason that it was added to the language was to be
On Wed, Oct 11, 2023 at 02:54:53AM +, mw via Digitalmars-d-learn wrote:
> Hi,
>
> I want to confirm: in the following loop, is the array literal `a` vs.
> `b` stack or heap allocated? and how many times?
>
> void main() {
>
> int[2] a;
This is stack-allocated. Once per call to the function.
On Sat, Oct 07, 2023 at 12:00:48AM +, claptrap via Digitalmars-d-learn
wrote:
>
> char[] foo;
> foo.length = 4;
> foo[] = 'a'; // ok sets all elements
> foo[] = "a"; // range error at runtime?
> foo[] = "ab"; // range error at runtime?
>
> So I meant to init with a char literal but accidentl
On Mon, Sep 11, 2023 at 10:39:00PM +, Salih Dincer via Digitalmars-d-learn
wrote:
> On Monday, 11 September 2023 at 22:13:25 UTC, H. S. Teoh wrote:
> >
> > Because sometimes I want a specific type.
> >
>
> it's possible...
>
> ```d
> alias ST = Options;
> void specificType(ST option = ST()
On Mon, Sep 11, 2023 at 10:05:11PM +, Salih Dincer via Digitalmars-d-learn
wrote:
> On Monday, 11 September 2023 at 20:17:09 UTC, H. S. Teoh wrote:
> >
> > Someone should seriously come up with a way of eliminating the
> > repeated type name in default parameters.
>
> Why not allow it to be
On Mon, Sep 11, 2023 at 07:59:37PM +, ryuukk_ via Digitalmars-d-learn wrote:
[...]
> Recent version of D added named arguments so you can do something
> like:
>
> ```D
> void someFunction(Options option = Options(silenceErrors: false))
> ```
>
> I don't like the useless repeating "option opti
On Sat, Sep 09, 2023 at 09:21:32AM +, rempas via Digitalmars-d-learn wrote:
> On Saturday, 9 September 2023 at 08:54:14 UTC, Brad Roberts wrote:
> > I'm pretty sure this is your problem. You're allocating size bytes
> > which is only going to work where sizeof(T) == 1. Changing to
> > malloc(
On Fri, Sep 08, 2023 at 06:59:21PM +, rempas via Digitalmars-d-learn wrote:
> On Friday, 8 September 2023 at 16:02:36 UTC, Basile B. wrote:
> >
> > Could this be a problem of copy construction ?
>
> I don't think so. The assertion seems to be violated when `malloc` is used.
> And when I asser
On Fri, Sep 01, 2023 at 03:53:42AM +, Alexibu via Digitalmars-d-learn wrote:
> Why do I need to copy data out of memory mapped files to avoid seg faults.
> This defeats the purpose of memory mapped files.
> Shouldn't the GC be able to manage it if I keep a pointer into it.
The GC does not mana
On Thu, Jul 27, 2023 at 10:15:47PM +, Cecil Ward via Digitalmars-d-learn
wrote:
> How do I get a wstring or dstring with a code point of 0xA0 in it ?
> That’s a type of space, is it? I keep getting a message from the LDC
> compiler something like "Outside Unicode code space" in my unittests
>
On Mon, Jul 10, 2023 at 09:30:57AM +, IchorDev via Digitalmars-d-learn
wrote:
[...]
> From the spec it sounds as though (but good luck testing for sure)
> that if you have (for example) 6 big dummy key-value pairs in the AA
> to begin with, then if you use `.clear` it "Removes all remaining ke
On Sat, Jul 08, 2023 at 05:15:26PM +, Cecil Ward via Digitalmars-d-learn
wrote:
> I have a dynamic array of dstrings and I’m spending dstrings to it. At
> one point I need to append a zero-length string just to increase the
> length of the array by one but I can’t have a slot containing garbag
On Fri, Jun 30, 2023 at 07:05:23PM +, Cecil Ward via Digitalmars-d-learn
wrote:
[...]
It would help if you could post the complete code that reproduces the
problem. Or, if you do not wish to reveal your code, reduce it to a
minimal case that still exhibits the same problem, so that we can see
On Fri, Jun 30, 2023 at 03:43:14PM +, Cecil Ward via Digitalmars-d-learn
wrote:
[...]
> Since I can pass my main function some compile-time-defined input, the
> whole program should be capable of being executed with CTFE, no? So in
> that case pragma( msg ) should suffice for a test situation?
On Fri, Jun 30, 2023 at 03:18:41PM +, lili via Digitalmars-d-learn wrote:
> struct Point {
> int x;
> int y;
> this(int x, int y) { this.x =x; this.y=y;}
> }
>
> void addPoint(Point a, Point b) {
>...
> }
>
> How too wirte this: addPoint({4,5}, {4,6})
On Friday, 23 June 2023 at 15:22:36 UTC, DLearner wrote:
On Friday, 23 June 2023 at 14:31:45 UTC, FeepingCreature wrote:
On Friday, 23 June 2023 at 14:22:24 UTC, DLearner wrote:
[...]
```
static assert(__traits(isPOD, int)); // ok.
static assert(__traits(isPOD, byte)); // ok.
```
It's a bug i
On Wed, Jun 21, 2023 at 02:09:26AM +, Cecil Ward via Digitalmars-d-learn
wrote:
> First is an easy one:
>
> 1.) I have a large array and a sub-slice which I want to set up to be
> pointing into a sub-range of it. What do I write if I know the start
> and end indices ? Concerned about an off-b
On Sun, Jun 18, 2023 at 03:51:14PM -0600, Jonathan M Davis via
Digitalmars-d-learn wrote:
> On Sunday, June 18, 2023 2:24:10 PM MDT Cecil Ward via Digitalmars-d-learn
> wrote:
> > I wasn’t intending to use DMD, rather ldc if possible or GDC
> > because of their excellent optimisation, in which DM
On Thu, Jun 15, 2023 at 12:49:30AM +, mw via Digitalmars-d-learn wrote:
> Hi,
>
> I switched to a different machine to build my project, suddenly I got
> lots of link errors. (It builds fine on the old machine, and my
> software version are the same on both machines LDC - the LLVM D
> compiler
On Sat, Jun 10, 2023 at 09:58:12PM +, Cecil Ward via Digitalmars-d-learn
wrote:
> On Friday, 9 June 2023 at 15:07:54 UTC, Murloc wrote:
[...]
> > So you can optimize memory usage by using arrays of things smaller
> > than `int` if these are enough for your purposes, but what about
> > using th
On Fri, Jun 09, 2023 at 11:24:38AM +, Murloc via Digitalmars-d-learn wrote:
[...]
> Which raised another question: since objects of types smaller than
> `int` are promoted to `int` to use integer arithmetic on them anyway,
> is there any point in using anything of integer type less than `int`
>
On Wed, May 31, 2023 at 06:43:52PM +, Cecil Ward via Digitalmars-d-learn
wrote:
> Is there an explanation of how D’s ‘import’ works somewhere? I’m
> trying to understand the comparison with the inclusion of .h files,
> similarities if any and differences with the process.
Unlike C's #include,
On Tue, May 30, 2023 at 01:24:46AM +, John Xu via Digitalmars-d-learn wrote:
> On Monday, 29 May 2023 at 11:21:11 UTC, Adam D Ruppe wrote:
> > On Monday, 29 May 2023 at 09:35:11 UTC, John Xu wrote:
> > > Error: variable `column` cannot be read at compile time
> >
> > you should generally g
On Sat, May 27, 2023 at 05:49:27PM +, vushu via Digitalmars-d-learn wrote:
> On Saturday, 27 May 2023 at 16:38:43 UTC, Steven Schveighoffer wrote:
[...]
> > void make_lava(T)(ref T lava) if (hasMagma!T) {
> > lava.magma();
> > }
> >
> > void make_lava(T)(ref T lava_thing) if (!hasMagma!T){
On Wed, May 10, 2023 at 10:57:13PM +, Chris Piker via Digitalmars-d-learn
wrote:
> On Wednesday, 10 May 2023 at 20:25:48 UTC, H. S. Teoh wrote:
> > On Wed, May 10, 2023 at 07:56:10PM +, Chris Piker via
> > Digitalmars-d-learn wrote: [...]
> > I also suffer from left/right confusion, and al
On Wed, May 10, 2023 at 07:56:10PM +, Chris Piker via Digitalmars-d-learn
wrote:
[...]
> My problem with the terms lvalue and rvalue is much more basic, and is
> just a personal one that only affects probably 0.1% of people. I just
> can't keep left vs. right straight in real life. "Right" i
On Wed, May 10, 2023 at 03:24:48PM +, Chris Piker via Digitalmars-d-learn
wrote:
[...]
> It's off topic, but I forget why managing memory for rvalues* was
> pushed onto the programmer and not handled by the compiler. I'm sure
> there is a good reason but it does seem like a symmetry breaking
On Wed, Apr 26, 2023 at 11:07:39PM +, WhatMeWorry via Digitalmars-d-learn
wrote:
> On Wednesday, 26 April 2023 at 23:02:07 UTC, Richard (Rikki) Andrew
> Cattermole wrote:
> > Don't forget ``num % 2 == 0``.
> >
> > None should matter, pretty much all production compilers within the
> > last 30
On Wed, Apr 26, 2023 at 06:24:08PM +, DLearner via Digitalmars-d-learn
wrote:
> Consider:
> ```
> struct S1 {
>int A;
>int B;
>int foo() {
> return(A+B);
>}
> }
>
> struct S2 {
>int A;
>int B;
> }
> int fnAddS2(S2 X) {
>return (X.A + X.B);
> }
>
> void main(
On Wed, Apr 12, 2023 at 08:23:51PM +, rempas via Digitalmars-d-learn wrote:
> Sorry if the title doesn't make any sense, let me explain. So, I do have the
> following code that does not compile:
>
> ```d
> import core.sys.posix.pthread; /* The library */
>
> struct Thread {
> private:
> pth
On Thu, Apr 06, 2023 at 01:20:28AM +, Paul via Digitalmars-d-learn wrote:
[...]
> Yes I understand, basically, what's going on in hardware. I just
> wasn't sure if the access type was linked to the container type. It
> seems obvious now, since you've both made it clear, that it also
> depends
On Wed, Apr 05, 2023 at 10:34:22PM +, Paul via Digitalmars-d-learn wrote:
> On Tuesday, 4 April 2023 at 22:20:52 UTC, H. S. Teoh wrote:
>
> > Best practices for arrays in hot loops:
[...]
> > - Where possible, prefer sequential access over random access (take
> > advantage of the CPU cache h
On Tue, Apr 04, 2023 at 09:35:29PM +, Paul via Digitalmars-d-learn wrote:
[...]
> Well Steven just making the change you said reduced the execution time
> from ~6-7 secs to ~3 secs. Then, including the 'parallel' in the
> foreach statement took it down to ~1 sec.
>
> Boy lesson learned in app
On Tue, Mar 21, 2023 at 05:29:22PM +, monkyyy via Digitalmars-d-learn wrote:
> On Tuesday, 21 March 2023 at 17:18:15 UTC, H. S. Teoh wrote:
> > On Tue, Mar 21, 2023 at 04:57:49PM +, monkyyy via
> > Digitalmars-d-learn wrote:
> > > My current method of making videos of using raylib to genera
On Tue, Mar 21, 2023 at 04:57:49PM +, monkyyy via Digitalmars-d-learn wrote:
> My current method of making videos of using raylib to generate screenshots,
> throwing those screenshots into a folder and calling a magic ffmpeg command
> is ... slow.
[...]
How slow is it now, and how fast do you
On Sat, Mar 11, 2023 at 04:21:40PM +, bomat via Digitalmars-d-learn wrote:
[...]
> Although I come from a C++ background, I'm not exactly a fanboy of
> that language (you can probably tell, otherwise I wouldn't be here).
> But after hearing praise for D for being a cleaner and better version
>
On Thu, Mar 02, 2023 at 09:55:55PM +, ryuukk_ via Digitalmars-d-learn wrote:
> On Thursday, 2 March 2023 at 21:38:23 UTC, ryuukk_ wrote:
> > On Thursday, 2 March 2023 at 21:21:14 UTC, Richard (Rikki) Andrew
> > Cattermole wrote:
[...]
> > > 2. Dustmite, so we have something we can work with.
>
On Sun, Feb 19, 2023 at 11:08:34AM +, realhet via Digitalmars-d-learn wrote:
> Hello,
>
> Is there a better way to transform a string array to a tuple or to an
> AliasSeq?
>
> ```
> mixin(customSyntaxPrefixes.format!`tuple(%(%s,%))`)
> ```
>
> I'd like to use this as variable length argument
On Fri, Feb 17, 2023 at 05:30:40PM +, Chris Piker via Digitalmars-d-learn
wrote:
[...]
> In order to handle new functionality it turns out that operatorG needs
> to be of one of two different types at runtime. How would I do
> something like the following:
>
> ```d
> auto virtualG; // <-- p
On Thu, Feb 16, 2023 at 08:51:39AM +, FeepingCreature via
Digitalmars-d-learn wrote:
[...]
> Springboarding off this post:
>
> This thread is vastly dominated by some people who care very much
> about this issue. Comparatively, for instance, I care very little
> because I think D already does
On Mon, Feb 13, 2023 at 06:04:40PM +, Matt via Digitalmars-d-learn wrote:
> Obviously, there is no "set" object in D,
Actually, bool[T] could be used as a set object of sorts. Or even
void[0][T], though that's a little more verbose to type. But this can be
aliased to something nicer (see below
On Mon, Feb 06, 2023 at 03:54:40PM +, bachmeier via Digitalmars-d-learn
wrote:
> On Sunday, 5 February 2023 at 08:48:34 UTC, Tamas wrote:
[...]
> > This is the specification for the D Programming Language.
>
> I've been bitten by that a few times over the years, though to be
> honest, I'm not
On Mon, Jan 30, 2023 at 03:59:52PM +, Adam D Ruppe via Digitalmars-d-learn
wrote:
> On Monday, 30 January 2023 at 15:37:56 UTC, Guillaume Piolat wrote:
> > Why not XML? :) It has comments, you can use backslashes too.
>
> no kidding, xml is an underrated format.
XML is evil.
Let me qualify
On Mon, Jan 23, 2023 at 08:06:28PM +, Alain De Vos via Digitalmars-d-learn
wrote:
> Mixing D with C or C++ or Python is looking for problems.
> Better write something in D.
> And write something in C/C++/Python.
> And have some form of communication between both.
I don't know about Python, bu
1 - 100 of 1001 matches
Mail list logo