Re: setjmp / longjmp

2015-06-09 Thread Stewart Gordon via Digitalmars-d-learn

On 27/04/2015 10:41, ketmar wrote:


i believe this has something to do with exception frames. but it needs
further investigation.


What is an exception frame, exactly?

Moreover, are these frames applicable even in sections of code where no throwing or 
catching of exceptions takes place?


Stewart.

--
My email address is valid but not my primary mailbox and not checked regularly.  Please 
keep replies on the 'group where everybody may benefit.


Re: setjmp / longjmp

2015-04-26 Thread Stewart Gordon via Digitalmars-d-learn

On 26/04/2015 06:56, ketmar wrote:


you shouldn't use setjmp/longjmp in D. use exceptions instead. something
like this:



True in the general case.  Still, there must be some reason that trying it in D causes an 
AV (even if I disable the GC).  I remain curious about what that reason is.


Some time ago, just for fun, I wrote an Unlambda to D compiler.  Except that I couldn't 
get the c builtin to work properly.  Exceptions cover typical uses cases, but a subtlety 
of it is that (roughly speaking) the continuation it emits can escape from the function it 
is passed into, and then when the continuation is later invoked it should return the 
program to the point at which c was invoked.  Essentially, it can wind the stack as well 
as unwinding it.  I envisaged that, maybe with the aid of setjmp and some trick to get GC 
to work with it, it could be made to work.


Stewart.

--
My email address is valid but not my primary mailbox and not checked regularly.  Please 
keep replies on the 'group where everybody may benefit.


Re: multidimensional array

2014-09-28 Thread Stewart Gordon via Digitalmars-d-learn

On 28/09/2014 08:48, ketmar via Digitalmars-d-learn wrote:

On Sun, 28 Sep 2014 04:24:19 +
Joel via Digitalmars-d-learn  wrote:


struct Spot { bool dot; }
spots = new Spot[][](800,600);

btw, does anybody know why i can do `new ubyte[256];` but not
`new ubyte[256][256];`? hate that.


You can do `new ubyte[256][256]`, if the destination type is a ubyte[256][].  The reason 
is that you are performing an allocation of the form `new T[n]`, which means allocate an 
array of n instances of type T.  In this case, T is ubyte[256], which is a static array type.


Stewart.

--
My email address is valid but not my primary mailbox and not checked regularly.  Please 
keep replies on the 'group where everybody may benefit.