[tech] Source questions
Posted: Mon Nov 29, 2004 8:40 am
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:
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
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")
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