On Mon, 01 Mar 2010 10:42:00 -0500, Ivan <ivan.se...@gmail.com> wrote:

On 1.3.2010 14:43, Steven Schveighoffer wrote:
On Mon, 01 Mar 2010 07:14:23 -0500, Ivan <ivan.se...@gmail.com> wrote:

On 1.3.2010 12:47, Steven Schveighoffer wrote:
On Mon, 01 Mar 2010 04:11:28 -0500, Ivan <ivan.se...@gmail.com> wrote:

The part of code in my main method is this:

try {
writefln("Starting main loop...");
global.loop.start();
writefln("Main loop finished...");
} catch(Exception e) {
writefln("Exception was: %s", e.msg);
}

From what I can see an exception was thrown ("unable to write to
stream") and the only line I added to the loop is this:

writefln(". %s", counter++);

If that line is removed, an exception seams to be thrown from the line
writefln("Main loop finished...");

Post more code. I suspect you are messing up something. It appears that you may be closing stdout, but I can't be sure because your code is not
complete.


The code can be seen here: http://github.com/ivans/ifs3D
I didn't and still don't want to bother anyone too much. :)

It should compile on windows with a command found in a readme file.

I don't think I am closing stdout anywhere and I probably am doing
something wrong somewhere, but can't figure out where and what.

Your code is too complex for me to understand quickly :)

Comment out other lines until you figure out which one closes it.

Start with commenting out the entire loop :) If that then works, you
know something inside the loop is killing stdout.

BTW, are you compiling in Windows mode? I.e. do you see a console on the
screen when you run it? If not, then there is no stdout or stdin. From
your command line in the readme, I don't think you are. However, in that
case, I don't think you'd get anywhere or see any output.

Thank you for helping. I did what you suggested and started commenting out code to get it working. I finally got to a working code with just two lines commented out:

http://github.com/ivans/ifs3D/commit/339ca5ee58661d636bfcd878c08b06bacede7dca

These lines have nothing to do with streams and stdout, so I still don't understand what is going on. But this part of code is very old and stupid (allocating a lot of unneccessary real[][]'s) so I guess the next step is to figure out a smarter way to do that part and see if the exception goes away :).

I suspect there may be a bug in dmd when dealing with reals, specifically with your array creation routine.

That code doesn't seem to be incorrect by any means.

Try building the resulting arrays manually (that is, instead of using that array template function), and see if it helps.

Also, try removing the calls to the inner sq function (BTW, you don't need to make that an inner function, doing so unnecessarily complicates things).

If you can find the thing that fixes it, we may be able to find a reduced test case. Also, try upgrading your compiler to the latest if you haven't already.

-Steve

Reply via email to