On Thursday, 18 September 2014 at 22:16:48 UTC, Ali Çehreli wrote:
If you are holding an address in a void*, you must make sure
that the original object is still at that location when you
attempt to access the object.
Does that mean, that there is no way to make a global stack
accessible
On 09/19/2014 05:14 AM, seany wrote:
On Thursday, 18 September 2014 at 22:16:48 UTC, Ali Çehreli wrote:
If you are holding an address in a void*, you must make sure that the
original object is still at that location when you attempt to access
the object.
Does that mean, that there is no
On Friday, 19 September 2014 at 12:14:19 UTC, seany wrote:
On Thursday, 18 September 2014 at 22:16:48 UTC, Ali Çehreli
wrote:
If you are holding an address in a void*, you must make sure
that the original object is still at that location when you
attempt to access the object.
Does that
Consider this snippet:
import std.stdio;
import std.conv;
import core.vararg;
void main() {
string[] s = [aa, bb, cc];
string []* ss;
void * v;
ss = s;
v = cast(void*)s;
ss = cast(string[]*) v;
s = *ss;
writeln(s);
}
This fails, Stack
Found, it should have been v = cast(void*)ss;
sorry.
On 09/18/2014 01:59 PM, seany wrote:
string[] s = [aa, bb, cc];
string []* ss;
void * v;
ss = s;
v = cast(void*)s;
Not s, but its address should be assigned to v:
v = cast(void*)s;
Only then it will match its reverse operation:
ss =
Yes, thank you, I corrected that.
However, if this v is a member of a class, like
import std.stdio;
import std.conv;
import core.vararg;
struct S
{
void *v;
}
class C
{
S* sx = new S;
void dothings()
{
string[] ss = [1, 2, 4];
string[] *s;
void *vv;
s =
On 09/18/2014 02:35 PM, seany wrote:
struct S
{
void *v;
}
class C
{
S* sx = new S;
void dothings()
{
string[] ss = [1, 2, 4];
Note that ss is a local variable of a druntime type equivalent of the
following:
struct D_Slice_of_strings_
{
size_t
what if i needed to access many such runtime variables of many
types, and did not want to create a member for each type?
On Thursday, 18 September 2014 at 21:35:50 UTC, seany wrote:
Yes, thank you, I corrected that.
However, if this v is a member of a class, like
import std.stdio;
import std.conv;
import core.vararg;
struct S
{
void *v;
}
class C
{
S* sx = new S;
void dothings()
{
anonymous:
Here, the pointer to the stack escapes the function. Don't do
that!
Hopefully the D type system will be improved with scoping
tracking management, to turn similar operations into
compilation errors (as in Rust, but perhaps in a less refined
way).
Bye,
bearophile
On 09/18/2014 02:52 PM, seany wrote:
what if i needed to access many such runtime variables of many types,
and did not want to create a member for each type?
If you are holding an address in a void*, you must make sure that the
original object is still at that location when you attempt to
12 matches
Mail list logo