On Friday, 8 April 2022 at 09:08:07 UTC, Stanislav Blinov wrote:
On Friday, 8 April 2022 at 05:53:03 UTC, Elvis Zhou wrote:
assumeNoEscapeOrWhatever!DynamicArray structs;
structs ~= cast(A*)&b;
is it possible?
That's what `@trusted` is for. And that's also why it should be
On Friday, 8 April 2022 at 05:46:56 UTC, Elvis Zhou wrote:
On Friday, 8 April 2022 at 04:31:45 UTC, Elvis Zhou wrote:
[...]
I know where the issue comes from, dynamic array is GCed and
save the reference of a local variable in GCed memory is not
allowed, but here structs is assumed to not
On Friday, 8 April 2022 at 04:31:45 UTC, Elvis Zhou wrote:
struct A {}
struct B { A a; }
struct C { A a; }
A*[] structs;
B b;
init(&b);
structs ~= cast(A*)&b;
//Error: copying `cast(A*)& b` into allocated memory escapes a
reference to local variable `b`
C c;
init(&c);
struc
struct A {}
struct B { A a; }
struct C { A a; }
A*[] structs;
B b;
init(&b);
structs ~= cast(A*)&b;
//Error: copying `cast(A*)& b` into allocated memory escapes a
reference to local variable `b`
C c;
init(&c);
structs ~= cast(A*)&c;
//Error: copying `cast(A*)& c` into allocated memory escap
On Tuesday, 15 April 2014 at 10:53:42 UTC, Rikki Cattermole wrote:
On Monday, 14 April 2014 at 10:30:53 UTC, Elvis Zhou wrote:
Running ./redis-pubsub-example
Callback subscribe(["test1"])
Task terminated with uncaught exception: expected of $ or *
The error message gives no hint of
Running ./redis-pubsub-example
Callback subscribe(["test1"])
Task terminated with uncaught exception: expected of $ or *
The error message gives no hint of where the exception is
raised.How do you guys debug this type of error?
On Friday, 11 October 2013 at 22:33:31 UTC, Namespace wrote:
On Friday, 11 October 2013 at 21:16:38 UTC, Brad Roberts wrote:
It's due to having the destructor versioned out when building
foo and visible when building bar. When brought together,
you've created an incompatible whole. There's no
On Sunday, 13 October 2013 at 11:45:39 UTC, Elvis Zhou wrote:
On Thursday, 10 October 2013 at 18:56:58 UTC, Alejandro wrote:
Hi
I'm new in D, have some experience in JavaScript and PHP, and
learned, for long time ago, C and a bit little C++
I remember that when I learned C with co
On Thursday, 10 October 2013 at 18:56:58 UTC, Alejandro wrote:
Hi
I'm new in D, have some experience in JavaScript and PHP, and
learned, for long time ago, C and a bit little C++
I remember that when I learned C with console output, it was
two easy ways to catch input : one witch a required
On Monday, 10 June 2013 at 14:40:05 UTC, Kenji Hara wrote:
On Monday, 10 June 2013 at 09:42:56 UTC, Elvis wrote:
class A
{
enum TypeID = 1;
}
class B : A
{
enum TypeID = 2;
}
class C : A
{
enum TypeID = 3;
}
class D : B
{
enum TypeID = 4;
}
...
Could anybody shed some light on
class A
{
enum TypeID = 1;
}
class B : A
{
enum TypeID = 2;
}
class C : A
{
enum TypeID = 3;
}
class D : B
{
enum TypeID = 4;
}
...
Could anybody shed some light on how to make these TypeIDs auto
increment at compile time?
Timon Gehr wrote:
> On 12/21/2011 09:15 PM, Elvis Maehren wrote:
[...]
>> Moreover, in CTFE a failed cast terminates the interpretation ("cannot
>> reinterpret class from [...] to [...] at compile time").
>
> I don't think this is filed already. Maybe you want
Jacob Carlborg wrote:
> On 2011-12-21 21:15, Elvis Maehren wrote:
>> This works fine at runtime, but explodes in CTFE:
>> ---
>> bool isInstanceOf(T, O)(O o) {
>> return (cast(T) o) !is null;
>> }
>> ---
>>
[...]
> I don't think you can do
Vladimir Panteleev wrote:
> I believe that's what __traits(compiles, ...) is for:
__traits(compiles, cast(T) o) is true even if the cast blows up in CTFE, so
that doesn't work.
This works fine at runtime, but explodes in CTFE:
---
bool isInstanceOf(T, O)(O o) {
return (cast(T) o) !is null;
}
---
CTFE doesn't like "!is null" ("cannot compare [...] at compile time").
Moreover, in CTFE a failed cast terminates the interpretation ("cannot
reinterpret class from [.
15 matches
Mail list logo