Page 1 of 1

[tech] Source questions

Posted: Mon Nov 29, 2004 8:40 am
by Trurl
Hi everybody!

I've just had a look into the sources of exult and got stuck in "autoarray.h", which contains some sections I don't really understand. Maybe there's someone around who can help me out.
It's clear to me, how the code works, when it's compiled with exceptions enabled. But in the other case (that means, with HAVE_NO_EXCEPTIONS defined), there are basically two things, which astonished me:

1.) There is a function "inline static range_error"(l. 32), but in C++ (in contrast to C), defining functions without a return type is strictly forbidden.

2.) Later in the code (l. 61), it says:

Code: Select all

throw range_error("out of bounds")
At first, this looks weird to me cause here an exception is throwen, though exceptions are explicitly disabled.
My second question is, what this exception is supposed to look like: Normally, "throwing" a function would execute this function and then throw it's return value. In this case, however, there is no return value, so the statement is rather senseless and afaik it wouldn't compile either.

Are these really errors, or is there somehing I've to learn about C++ ? (well, of course, there is. But I mean, in relation to this specific case ;) )

Perhaps this topic would better fit into a C++ newsgroup, but right here in this place are the guys who wrote this piece of code, so I hope one of them reads this. And finally, this is a very Exult specific thread ;)

cu, Trurl

Re: [tech] Source questions

Posted: Mon Nov 29, 2004 9:12 am
by wjp
I would guess nobody tried to compile exult with HAVE_NO_EXCEPTIONS in quite a while :-)

Re: [tech] Source questions

Posted: Mon Nov 29, 2004 2:55 pm
by drcode
...and the developer who wrote that code, Dancer, isn't an active reader here. You might try emailing him using his address on our SF site (http://sourceforge.net/project/memberli ... up_id=2335).

Re: [tech] Source questions

Posted: Tue Nov 30, 2004 10:28 am
by Trurl
Well, it's not that important to me. I just wanted to know, whether that piece of code was ever compiled successfully and if it did, how the author managed to do so. Anyway, thanks for help!