Re: Class instance alignment

2021-02-19 Thread tsbockman via Digitalmars-d-learn
On Saturday, 20 February 2021 at 05:44:33 UTC, kinke wrote: There's https://github.com/dlang/druntime/blob/728f1d9c3b7a37eba4d59ee2637fb924053cba6d/src/core/internal/traits.d#L261. Thanks! That's helpful. But AFAIK, the GC only guarantees an alignment of 16 and doesn't respect any

Re: Class instance alignment

2021-02-19 Thread kinke via Digitalmars-d-learn
On Friday, 19 February 2021 at 23:53:55 UTC, tsbockman wrote: How can I get the alignment of a class instance? I know how to get the size: __traits(classInstanceSize, T) But, there doesn't appear to be any equivalent trait for the alignment. There's

Re: Include http based module

2021-02-19 Thread Mike Parker via Digitalmars-d-learn
On Friday, 19 February 2021 at 19:20:39 UTC, tcak wrote: Is there any way to include http(s) based modules into compilation (Please do not suggest dub etc)? No, the compiler only looks for modules on the filesystem via standard file paths, not via URI. There isn't any tool in the D

Re: raylib LoadTexture Mismatch between

2021-02-19 Thread Decabytes via Digitalmars-d-learn
On Friday, 19 February 2021 at 23:29:18 UTC, Steven Schveighoffer wrote: On 2/19/21 5:26 PM, Decabytes wrote: raylib-d does not have D wrappers for everything. You are supposed to use the C functions. D's string literals are null-terminated. However, the language only allows actual

Class instance alignment

2021-02-19 Thread tsbockman via Digitalmars-d-learn
How can I get the alignment of a class instance? I know how to get the size: __traits(classInstanceSize, T) But, there doesn't appear to be any equivalent trait for the alignment. (Knowing the alignment of a class instance is required to correctly use core.lifetime.emplace, or do any

Re: raylib LoadTexture Mismatch between

2021-02-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/19/21 5:26 PM, Decabytes wrote: Dlang and curly brace language noob here. I'm trying to work with the raylib-d library. I downloaded raylib-d using dub, and I installed raylib with my package manager on Manjaro.  I'm getting a mismatch in the arguments I'm passing to LoadTexture.

raylib LoadTexture Mismatch between

2021-02-19 Thread Decabytes via Digitalmars-d-learn
Dlang and curly brace language noob here. I'm trying to work with the raylib-d library. I downloaded raylib-d using dub, and I installed raylib with my package manager on Manjaro. I'm getting a mismatch in the arguments I'm passing to LoadTexture. source/app.d(7,32): Error: function

Include http based module

2021-02-19 Thread tcak via Digitalmars-d-learn
I have written a test module and put it into /var/www/html: module mymodule; import std.stdio; void testMe(){ writeln("I tested you!"); } Then I have a main file where I would like to call the function "testMe". My build line is as follows: dmd main.d "http://localhost/mymodule.d;

Re: How to get output of piped process?

2021-02-19 Thread kdevel via Digitalmars-d-learn
On Friday, 19 February 2021 at 13:42:46 UTC, Steven Schveighoffer wrote: [...] ignoring SIGPIPE is a process-wide thing, and so it's not appropriate for Phobos to make that decision for you. But it's trivial to ignore it. Sure. I've never been a fan of SIGPIPE. If you look around on the

Re: Creating 1000 instances

2021-02-19 Thread Simen Kjærås via Digitalmars-d-learn
On Friday, 19 February 2021 at 10:02:05 UTC, Siemargl wrote: On Friday, 19 February 2021 at 08:29:36 UTC, Ferhat Kurtulmuş wrote: Since classes are reference types all instances of files will be the same reference of "new File()", which you probably don't want. Is any differences between x

Re: How to get output of piped process?

2021-02-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/19/21 5:41 AM, kdevel wrote: On Friday, 19 February 2021 at 08:37:50 UTC, Imperatorn wrote: Does your iopipe handle... Pipes?  BTW: What about SIGPIPE? In an experimental code I have this    :    fout.rawWrite (buf);    fout.rawWrite ("\n");    writeln ("flushing");    fout.flush

Re: How to get output of piped process?

2021-02-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/19/21 3:37 AM, Imperatorn wrote: On Thursday, 18 February 2021 at 17:27:48 UTC, Steven Schveighoffer wrote: On 2/18/21 4:40 AM, frame wrote: [...] It's just the way it is. Everything in Phobos is a C FILE * (wrapped in a File). You need to use alternative i/o systems to get the

Re: Creating 1000 instances

2021-02-19 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 19 February 2021 at 10:02:05 UTC, Siemargl wrote: On Friday, 19 February 2021 at 08:29:36 UTC, Ferhat Kurtulmuş wrote: Since classes are reference types all instances of files will be the same reference of "new File()", which you probably don't want. Is any differences between x

Re: How to get output of piped process?

2021-02-19 Thread kdevel via Digitalmars-d-learn
On Friday, 19 February 2021 at 08:37:50 UTC, Imperatorn wrote: Does your iopipe handle... Pipes?  BTW: What about SIGPIPE? In an experimental code I have this : fout.rawWrite (buf); fout.rawWrite ("\n"); writeln ("flushing"); fout.flush ();

Re: Mixed language projects (D and C++)

2021-02-19 Thread Preetpal via Digitalmars-d-learn
On Friday, 19 February 2021 at 10:21:29 UTC, Max Haughton wrote: On Friday, 19 February 2021 at 10:18:28 UTC, Preetpal wrote: On Friday, 19 February 2021 at 10:01:36 UTC, Max Haughton wrote: On Friday, 19 February 2021 at 09:44:15 UTC, Preetpal wrote: [...] C++ interop is used every day.

Re: Mixed language projects (D and C++)

2021-02-19 Thread Max Haughton via Digitalmars-d-learn
On Friday, 19 February 2021 at 10:18:28 UTC, Preetpal wrote: On Friday, 19 February 2021 at 10:01:36 UTC, Max Haughton wrote: On Friday, 19 February 2021 at 09:44:15 UTC, Preetpal wrote: I want to reuse existing C++ code in a new project that I am writing in D and I want to use D in an

Re: Mixed language projects (D and C++)

2021-02-19 Thread Preetpal via Digitalmars-d-learn
On Friday, 19 February 2021 at 10:01:36 UTC, Max Haughton wrote: On Friday, 19 February 2021 at 09:44:15 UTC, Preetpal wrote: I want to reuse existing C++ code in a new project that I am writing in D and I want to use D in an existing C++ code base (it is not large). I do not anticipate

Re: Creating 1000 instances

2021-02-19 Thread Siemargl via Digitalmars-d-learn
On Friday, 19 February 2021 at 08:29:36 UTC, Ferhat Kurtulmuş wrote: Since classes are reference types all instances of files will be the same reference of "new File()", which you probably don't want. Is any differences between x and y definitions? MyClass [] x, y; x = new MyClass[7]; y=

Re: Mixed language projects (D and C++)

2021-02-19 Thread Max Haughton via Digitalmars-d-learn
On Friday, 19 February 2021 at 09:44:15 UTC, Preetpal wrote: I want to reuse existing C++ code in a new project that I am writing in D and I want to use D in an existing C++ code base (it is not large). I do not anticipate interop being an issue. [...] C++ interop is used every day. The

Mixed language projects (D and C++)

2021-02-19 Thread Preetpal via Digitalmars-d-learn
I want to reuse existing C++ code in a new project that I am writing in D and I want to use D in an existing C++ code base (it is not large). I do not anticipate interop being an issue. I am wondering if mixing D and C++ is a common practice? If it is a common practice, is anyone is currently

Re: Creating 1000 instances

2021-02-19 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 19 February 2021 at 08:29:36 UTC, Ferhat Kurtulmuş wrote: On Friday, 19 February 2021 at 08:04:19 UTC, Виталий Фадеев wrote: [...] files = new File[]( 1000 ); files[] = new File(); // add this Since classes are reference types all instances of files will be the same reference of

Re: Creating 1000 instances

2021-02-19 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 19 February 2021 at 08:41:06 UTC, Ferhat Kurtulmuş wrote: On Friday, 19 February 2021 at 08:29:36 UTC, Ferhat Kurtulmuş wrote: On Friday, 19 February 2021 at 08:04:19 UTC, Виталий Фадеев wrote: [...] files = new File[]( 1000 ); files[] = new File(); // add this Since classes are

Re: How to get output of piped process?

2021-02-19 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 18 February 2021 at 17:27:48 UTC, Steven Schveighoffer wrote: On 2/18/21 4:40 AM, frame wrote: [...] It's just the way it is. Everything in Phobos is a C FILE * (wrapped in a File). You need to use alternative i/o systems to get the information. [...] Does your iopipe

Re: Creating 1000 instances

2021-02-19 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 19 February 2021 at 08:04:19 UTC, Виталий Фадеев wrote: We have: class File { // WIN32_FIND_DATAW data; } void fastReadDir() { File[] files; // reserve space, allocating instances files = new File[]( 1000 ); // <--- trouble here ?

Creating 1000 instances

2021-02-19 Thread Виталий Фадеев via Digitalmars-d-learn
We have: class File { // WIN32_FIND_DATAW data; } void fastReadDir() { File[] files; // reserve space, allocating instances files = new File[]( 1000 ); // <--- trouble here ? // filling instances auto file = files.ptr;