[tech] Source questions

NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Forum rules
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Locked
Trurl
Posts: 3
Joined: Thu May 14, 2020 1:34 pm

[tech] Source questions

Post 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
wjp
Site Admin
Posts: 1708
Joined: Thu May 14, 2020 1:34 pm

Re: [tech] Source questions

Post by wjp »

I would guess nobody tried to compile exult with HAVE_NO_EXCEPTIONS in quite a while :-)
drcode
Site Admin
Posts: 2267
Joined: Thu May 14, 2020 1:34 pm

Re: [tech] Source questions

Post 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).
Trurl
Posts: 3
Joined: Thu May 14, 2020 1:34 pm

Re: [tech] Source questions

Post 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!
Locked