On Friday, 13 January 2023 at 12:46:33 UTC, Dennis wrote:
On Friday, 13 January 2023 at 12:33:28 UTC, kdevel wrote:
What must be added or changed in order to test every example
which is intended to produce an executable?
Support for separate compilation / ImportC would need to be
added to dsp
On Friday, 13 January 2023 at 19:16:17 UTC, H. S. Teoh wrote:
On Fri, Jan 13, 2023 at 08:31:17AM -0800, Ali Çehreli via
Digitalmars-d-learn wrote:
On 1/13/23 07:07, Gavin Ray wrote:
> This is "valid" D I hope?
Yes because static arrays are just elements side-by-side in
memory. You can cast an
Maybe it would be better to wrap the slice in a new class with an
invariant?
Because what I want to do is:
1. Ensure that the length of the underlying referenced/pointed-to
data is `PAGE_SIZE`
2. Benefit from the features of D that I can
The bounds-checking of slices saves a lot of headaches
On Friday, 13 January 2023 at 14:57:40 UTC, Ali Çehreli wrote:
On 1/13/23 06:49, Gavin Ray wrote:
> I am curious if you can return something like
`ubyte[PAGE_SIZE]*` or
> `ref ubyte[PAGE_SIZE]`?
A simple cast seems to work:
enum PAGE_SIZE = 4096;
enum BUF_POOL_NUM_PAGES = 1024;
alias frame_idx
I probably should have mentioned, the equivalent in C++ is the
below:
```cpp
#include
#include
#include
static constexpr size_t PAGE_SIZE = 4096;
static constexpr size_t BUF_POOL_NUM_PAGES = 1024;
class BufferPool
{
private:
alignas(PAGE_SIZE) std::byte data[BUF_POOL_NUM_PAGE
Suppose that you have a memory manager, or arena-like class,
which contains a buffer used to store memory.
And you want to hand out chunks of this memory to other parts of
your program. These chunks should all be `PAGE_SIZE`.
You might have something like:
```d
enum PAGE_SIZE = 4096;
enum B
On Thursday, 17 November 2022 at 09:52:11 UTC, Dukc wrote:
D has far less need for getters/setters than Java or C++. The
reason is [Uniform Function Call
Syntax](https://ddili.org/ders/d.en/ufcs.html). This means that
a member of a `struct` or `class` can start out as a normal
field and be la
On Monday, 14 November 2022 at 20:37:12 UTC, kdevel wrote:
On Monday, 14 November 2022 at 17:08:38 UTC, Gavin Ray wrote:
Just came here to say I hit the same bug, here's my import
list:
* https://issues.dlang.org/show_bug.cgi?id=19937
object._d_assert_fail linker error if compiling with
-ch
On Saturday, 28 May 2022 at 23:02:45 UTC, kdevel wrote:
On Friday, 18 March 2022 at 19:42:02 UTC, Anonymouse wrote:
On Thursday, 17 March 2022 at 14:00:45 UTC, kdevel wrote:
If ```import std.regex;``` is commented out or if
```-checkaction=context``` is removed from the cmd line the
unittest p
On Monday, 29 August 2022 at 15:52:31 UTC, rikki cattermole wrote:
After a bunch of playing around I managed to determine that it
is as simple as the mode.
exists(dbFileName) ? "r+" : "w+"
Will fix it.
Of course you shouldn't delete the file like that method is
doing. It should probably re
On Monday, 29 August 2022 at 07:04:49 UTC, bauss wrote:
Does anyone know what is happening here? It's really puzzling.
You probably need to flush the output.
That's a good idea. I gave it a shot, and the following doesn't
seem to change anything unfortunately:
```d
void writePage(PageId pa
I've put the code, stripped to a minimal example here:
- https://ldc.godbolt.org/z/fzsx3Tnnn
You can see that the single write + read version of the code
works just fine:
```
pageData[0..4] = [1, 2, 3, 4]
readData[0..4] = [1, 2, 3, 4]
```
Where here, `pageData` is the data to be written to a f
Ahh, thanks a ton for these pointers, much appreciated!
On Monday, 15 August 2022 at 22:47:21 UTC, frame wrote:
On Monday, 15 August 2022 at 20:51:07 UTC, Gavin Ray wrote:
Is there an alternative to `OutBuffer` or a method you can
call to set a byte limit on the resizing?
Are you looking for a circular buffer?
https://code.dlang.org/packages/ring
I'm learning about databases by implementing one from scratch,
and decided I'd do it in D since it has the highest-level syntax
for low-level code & seemed a natural fit.
Currently I am trying to implement the "slotted page" structure
and storage (serialization/de-serialization from binary dat
On Wednesday, 2 June 2021 at 16:07:35 UTC, Basile.B wrote:
works a expected. The reason why is that your array elements
are fat pointers, so when you dup a, you dup some fats pointer,
so you got the same elements as "a" but accessible from another
chunck of memory.
Would it be worth modifying
On Thursday, 27 May 2021 at 10:48:43 UTC, Basile B. wrote:
https://forum.dlang.org/post/myrjutqyzpzlyltrd...@forum.dlang.org
Thank you for sharing this!
The difference between setting `pragma(LDC_no_moduleinfo);` at
the top, and `-Os -gline-tables-only` in compiler flags is
drastic.
- Stan
On Tuesday, 25 May 2021 at 18:03:00 UTC, evilrat wrote:
That last one with someInt is what I warned about. D ctor
messed up class layout, in this simple case where class data
isn't used it almost works, but will be practically unusable in
real scenarios.
Ah =/
You have this in your code examp
On Tuesday, 25 May 2021 at 11:38:03 UTC, evilrat wrote:
I did some basic testing with code above, it seems class layout
is recursively linear at least on Windows, and D follows C++
rules close enough, at least it works if one comments out all
but the first base, and the rest can be hand crafted
On Tuesday, 25 May 2021 at 06:02:55 UTC, evilrat wrote:
Anyway all this stuff requires thorough research & testing as
such ABI tinkering is very easy to mess up and very hard to
debug, for example if you mess up the order(functions layout)
it can land on another final method call that seemingly
On Monday, 24 May 2021 at 20:31:18 UTC, sighoya wrote:
On Monday, 24 May 2021 at 17:39:38 UTC, Gavin Ray wrote:
Hence why I was asking how to make D structs/classes that have
compatible or identical vtables to multiply inherited objects
to pass as arguments to `extern (C++)` functions.
I thin
On Sunday, 23 May 2021 at 21:08:06 UTC, Ola Fosheim Grostad wrote:
On Sunday, 23 May 2021 at 21:02:31 UTC, Gavin Ray wrote:
I don't really know anything at all about compilers or
low-level code -- but is there any high-level notion of
"inheritance" after it's been compiled?
Yes, in the struct
On Sunday, 23 May 2021 at 20:16:17 UTC, Ola Fosheim Grostad wrote:
On Sunday, 23 May 2021 at 19:44:01 UTC, Gavin Ray wrote:
So one of the problems with generating D code for bindings to
C++ is that there's no true/direct multiple inheritance.
If anyone happens to understand well how vtables wo
So one of the problems with generating D code for bindings to C++
is that there's no true/direct multiple inheritance.
If anyone happens to understand well how vtables work and the way
the compiler treats these things, is there a way to hackily make
semantically-equivalent objects?
An exampl
On Monday, 29 March 2021 at 17:02:40 UTC, evilrat wrote:
Also with delegates (lazy), you get the type checks however you
must have to declare parameters on call site, which can be PITA
in the future when doing refactoring will be necessary.
Better plan ahead as the number of changes will exp
On Monday, 29 March 2021 at 16:31:49 UTC, Paul Backus wrote:
On Monday, 29 March 2021 at 16:20:59 UTC, Ali Çehreli wrote:
auto myFunc(F)(string name, F func)
{
// This condition could be a template constraint but they
don't
// support error messages.
static assert (is (Parameters!func ==
Brief question, is it possible to write this so that the "alias
fn" here appears as the final argument?
auto my_func(alias fn)(string name, string description, auto
otherthing)
The above seems to work, since the type of "fn" can vary and it
gets called inside of "my_func", but from an ergo
27 matches
Mail list logo