
"Ion GaztaƱaga" wrote
Andy Little(e)k dio:
[...]
It might be useful to specify some use cases where you are running in an embedded environment with separate processes that need shmem and you have no exceptions, and if no-exceptions is policy or forced by compiler. Its just that that seems to be quite a narrow set. Some use cases would help.
I can only talk about my experience in railway embedded systems, where we use QNX multi-process operating system. Exceptions are disabled to save space and increase error-reporting speed to prevent as quickly as possible important failures in control systems. The systems has multiple processes, (one alarm detector, one log server, one communication proxy, one monitorization process...) that share a common shared memory data-base. The most important thing is that multi-processing allows memory-protection, so that if the monitorization process crashes, it can't make crash other processes with some memory overflow issue and it can be restarted and it will start working again. It could be possible to make all processes threads of just one big process but this way, you can't protect important processes from crashes of other less critical processes. Separate processes also allow easier development, in my opinion.
Ok ...thanks for the example. Though it raise a lot of questions which perhaps cant be anwered. As I understand it the no-exceptions requirement in this example is a policy based on the fact that exceptions for error recovery have been found to be too slow to respond? I'm surprised at the extra memory use as there surely must be some extra error checking in the non-exception case. OTOH Is exception use increasing the size of stack required?. Hmm... being no expert , I guess I should avoid prying too far into your applications ;-) It also helps to understand why shmem is set up currently as it is. [...]
Sorry for being dim. Whats a std::nothrow parameter?
See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcstdlib/ht...
Thanks for the link!
The problem is not emulation but reusing that code in another environment that uses exceptions, since the reused code won't work anymore.
If anyone wished to do that I guess you would need to revisit the reasoning to them in this review.
Anyway, I will repeat it here again: I accept RAII only for Shmem.
I am now wondering though if the change over to RAII is going to have other unwelcome side-effects on a design that has not been designed around it? This is pure speculation. I havent looked deeply into the matter. Also are you reasonably happy with that decision ( RAII only for Shmem)? I guess it is not too helpful for the application above for example. I wonder if there are other situations where the decision has been taken not to use exceptions, because if there were enough of them it might be worth re-opening the argument for the defense ;-) regards Andy Little