| Thread overview | |||||
|---|---|---|---|---|---|
|
January 27, 2007 Problems with array handles | ||||
|---|---|---|---|---|
| ||||
I'm having some issues dealing with array handles. For example, if I write this:
static EventTypeSpec[1] events =
[
{ EventClass.kEventClassWindow, kEventWindowBoundsChanged }
];
writefln("events: 0x%x", events);
And execute the code, I get a Bus Error down inside writefln().
According to the language specification here (http://www.digitalmars.com/d/arrays.html), that seems like a perfectly reasonable thing to do, as well as the next thing, below.
If I write this:
static EventTypeSpec[1] events =
[
{ EventClass.kEventClassWindow, kEventWindowBoundsChanged }
];
EventTypeSpec* p = events; // <--- error here
writefln("events: 0x%x", p);
I get a compile error on the line marked above:
src/test/d/darbon/tests/GrabBag.d:74: Error: cannot implicitly convert expression (events) of type EventTypeSpec [1] to EventTypeSpec *
This is using GDC based on DMD 1.00.
Sorry for all the questions, but I keep stumbling over things that I wouldn't expect to give me trouble.
| ||||
January 27, 2007 Re: Problems with array handles | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Rick Mann | Rick Mann wrote:
> I'm having some issues dealing with array handles. For example, if I write this:
>
> static EventTypeSpec[1] events =
> [
> { EventClass.kEventClassWindow, kEventWindowBoundsChanged }
> ];
> writefln("events: 0x%x", events);
>
> And execute the code, I get a Bus Error down inside writefln().
>
> According to the language specification here (http://www.digitalmars.com/d/arrays.html), that seems like a perfectly reasonable thing to do, as well as the next thing, below.
>
> If I write this:
>
> static EventTypeSpec[1] events =
> [
> { EventClass.kEventClassWindow, kEventWindowBoundsChanged }
> ];
> EventTypeSpec* p = events; // <--- error here
> writefln("events: 0x%x", p);
>
> I get a compile error on the line marked above:
>
> src/test/d/darbon/tests/GrabBag.d:74: Error: cannot implicitly convert expression (events) of type EventTypeSpec [1] to EventTypeSpec *
>
>
> This is using GDC based on DMD 1.00.
>
> Sorry for all the questions, but I keep stumbling over things that I wouldn't expect to give me trouble.
>
Try:
events.ptr
BTW, this really belongs in the 'learn' ng.
| |||
January 27, 2007 Re: Problems with array handles | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Don Clugston | Don Clugston Wrote: > Try: > events.ptr Thanks, that seems to make it work. > BTW, this really belongs in the 'learn' ng. Okay, I'll post these kinds of questions there, then. | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply