I'm trying to get the factory pattern going with classes
class A {}
class B {}
class C {}
auto getClassById(uint id)
{
if (id == 0) {
return cast(A)Object.factory("A");
} else if(id == 1) {
return cast(B)Object.factory("B");
} else {
return cast(C)Object.fact
On Sunday, 9 August 2020 at 01:03:51 UTC, Bruce Carneal wrote:
The .alignof attribute of __vector(ubyte[32]) is 32 but
initializing an array of such vectors via an assignment to
.length has given me 16 byte alignment (and subsequent seg
faults which I suspect are related).
Is sub .alignof ali
On Sunday, 9 August 2020 at 01:03:51 UTC, Bruce Carneal wrote:
Is sub .alignof alignment expected here? IOW, do I have to
manually manage memory if I want alignments above 16?
IIRC, yes when using the GC, as that only guarantees 16-bytes
alignment. Static arrays on the stack should be aligned
On Sunday, 9 August 2020 at 05:49:23 UTC, user1234 wrote:
On Sunday, 9 August 2020 at 01:56:54 UTC, Bruce Carneal wrote:
On Sunday, 9 August 2020 at 01:03:51 UTC, Bruce Carneal wrote:
Manually managing the alignment eliminated the seg faulting.
Additionally, I found that std.experimental.ma
On Sunday, 9 August 2020 at 09:58:18 UTC, Johan wrote:
On Sunday, 9 August 2020 at 01:03:51 UTC, Bruce Carneal wrote:
The .alignof attribute of __vector(ubyte[32]) is 32 but
initializing an array of such vectors via an assignment to
.length has given me 16 byte alignment (and subsequent seg
fa
On Sunday, 9 August 2020 at 10:02:32 UTC, kinke wrote:
On Sunday, 9 August 2020 at 01:03:51 UTC, Bruce Carneal wrote:
Is sub .alignof alignment expected here? IOW, do I have to
manually manage memory if I want alignments above 16?
IIRC, yes when using the GC, as that only guarantees 16-bytes
On 8/9/20 5:16 AM, lexxn wrote:
I'm trying to get the factory pattern going with classes
class A {}
class B {}
class C {}
auto getClassById(uint id)
{
if (id == 0) {
return cast(A)Object.factory("A");
} else if(id == 1) {
return cast(B)Object.factory("B");
} el
On 8/8/20 7:58 PM, Hassan wrote:
Hello
I'm trying to get getopt to recognize an argument that may or may not
take a value. Here's an example :
../hashtrack --list
../hashtrack --list filter
The problem is that if I point list to a string variable, the first call
fails with "Missing value fo
On 8/9/20 8:09 AM, Bruce Carneal wrote:
On Sunday, 9 August 2020 at 09:58:18 UTC, Johan wrote:
On Sunday, 9 August 2020 at 01:03:51 UTC, Bruce Carneal wrote:
The .alignof attribute of __vector(ubyte[32]) is 32 but initializing
an array of such vectors via an assignment to .length has given me 1
On 8/9/20 8:37 AM, Steven Schveighoffer wrote:
I think this has come up before, there may even be
a bug report on it.
Found one, I'll see if I can fix the array runtime:
https://issues.dlang.org/show_bug.cgi?id=10826
-Steve
On Sunday, 9 August 2020 at 12:37:06 UTC, Steven Schveighoffer
wrote:
On 8/9/20 8:09 AM, Bruce Carneal wrote:
[...]
All blocks in the GC that are more than 16 bytes are aligned by
32 bytes. You shouldn't have any 16 byte blocks here, because
each element is 32 bytes long.
However, if your
Thanks for the reply Steve
On Sunday, 9 August 2020 at 12:20:16 UTC, Steven Schveighoffer
wrote:
2. If your optional parameters are not tied to the option
itself, then don't accept them via getopt. In other words, if
`hashtrack filter` is supposed to be valid, then filter isn't
an option afte
On Sunday, 9 August 2020 at 12:24:05 UTC, Steven Schveighoffer
wrote:
On 8/9/20 5:16 AM, lexxn wrote:
I'm trying to get the factory pattern going with classes
class A {}
class B {}
class C {}
auto getClassById(uint id)
{
if (id == 0) {
return cast(A)Object.factory("A");
} e
On Sunday, 9 August 2020 at 12:24:05 UTC, Steven Schveighoffer
wrote:
If you know what your class is going to be, I'd just import the
file that contains it and avoid the whole Object.factory deal.
It's going to go away anyways.
Not sure if it's a good idea in my case. I'm going to be using
On 8/9/20 7:27 AM, lexxn wrote:
> I assume that the correct syntax for the getClassById is
> Object getClassById(uint id) {
> if (id == 0) {
> return new A();
> } else if (id == 1) {
> return new B();
> } else {
> return new C();
> }
> }
> or maybe I
On 8/9/20 10:58 AM, lexxn wrote:
On Sunday, 9 August 2020 at 12:24:05 UTC, Steven Schveighoffer wrote:
If you know what your class is going to be, I'd just import the file
that contains it and avoid the whole Object.factory deal. It's going
to go away anyways.
Not sure if it's a good idea i
On 8/9/20 10:27 AM, lexxn wrote:
On Sunday, 9 August 2020 at 12:24:05 UTC, Steven Schveighoffer wrote:
Object getClassById(uint id)
{
if (id == 0) {
return new A;
} else if(id == 1) {
return new B;
} else {
return new C;
}
}
I assume that the correct
I don't know much more about D than creating a 'hello world' exe
file with the DMD Compiler
but I'm interested in using the eBay/tsv-utils binaries.
Unfortunately, the author didn't create any MS Windows binaries:
https://github.com/eBay/tsv-utils/releases
Does anyone know how to compile this co
On Sunday, 9 August 2020 at 15:56:31 UTC, Ali Çehreli wrote:
On 8/9/20 7:27 AM, lexxn wrote:
module deneme;
import std.stdio;
interface I {
void methodName();
}
class A : I {
void methodName() {
writeln("A");
}
}
class B : I {
void methodName() {
writeln("B");
}
}
class C
On Thursday, 6 August 2020 at 22:24:43 UTC, Paul Backus wrote:
[1] https://dlang.org/spec/expression.html#is_expression
Thanks
Is cross-module-inlining enabled by default in LDC when compiling
in release mode or do I have to use explicitly flag for it? I
can't find any such flag from the output of neither
ldc2 -h
nor
ldmd2 -h
.
Johan Engelen mentioned this, then experimental, flag in his
DConf talk from 20
On Sunday, 9 August 2020 at 22:45:16 UTC, claptrap wrote:
I'm not 100% sure but I think LDC did cross module inlining by
default at some point, then I updated the compiler and had to
add the LTO thing. I think there is an option to enable just
cross module inlining, but if you want speed you'll
On Sunday, 9 August 2020 at 22:18:13 UTC, Per Nordlöw wrote:
Is cross-module-inlining enabled by default in LDC when
compiling in release mode or do I have to use explicitly flag
for it? I can't find any such flag from the output of neither
ldc2 -h
nor
ldmd2 -h
.
Johan Engelen ment
On Sunday, 9 August 2020 at 19:04:07 UTC, Marc wrote:
I don't know much more about D than creating a 'hello world'
exe file with the DMD Compiler
but I'm interested in using the eBay/tsv-utils binaries.
Unfortunately, the author didn't create any MS Windows binaries:
https://github.com/eBay/tsv-
On Mon, Aug 10, 2020 at 12:20 AM Per Nordlöw via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
>
> Is cross-module-inlining enabled by default in LDC when compiling
> in release mode or do I have to use explicitly flag for it? I
> can't find any such flag from the output of neithe
On Mon, Aug 10, 2020 at 12:50 AM claptrap via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
> On Sunday, 9 August 2020 at 22:18:13 UTC, Per Nordlöw wrote:
> > ...
> If you enable link time optimisation you get cross module
> inlining,
>
> -flto=full
>
> I'm not 100% sure but I th
generating random numbers using
https://dlang.org/library/std/random/uniform01.html
I find the example given in this section totally incomprehensible
.. Can any help me answer two simple questions:
How to generate a random floating number in range [0,1) ?
How to set a seed value, prior to genera
On 8/9/20 10:51 PM, Andy Balba wrote:
generating random numbers using
https://dlang.org/library/std/random/uniform01.html
I find the example given in this section totally incomprehensible
... Can any help me answer two simple questions:
How to generate a random floating number in range [0,1) ?
28 matches
Mail list logo