Re: Exceptions, Go to Hell!
On Aug 25, 9:03 pm, =D6=F6 Tiib <oot...@hot.ee> wrote:
On 25 aug, 10:35, Goran Pusic <gor...@cse-semaphore.com> wrote:
[...]
I don't understand that "assert(0)" part. It reads like
"abort()" for me and "return" after it seems unreachable code.
Typically, with assert(0) you'll get an error message with the
line number and filename where the assert occurred. And the
return after it isn't unreachable if the code is compiled with
NDEBUG defined. (Not generally a good idea, but sometimes you
can't avoid it.)
[...]
If you have an OS that overcommits memory, you very likely
won't get a bad_alloc anyway.
Yes. BTW, I hate overcommit, because large swaths of people have
experienced it and now think that handling memory correctly is
effectively futile. But that's not how C, C++, nor many other a-
language, is meant to work, not at all.
That overcommit is red herring since it can be turned off with some
kernel parameter like "vm.overcommit_memory = 0". If an user refuses
to turn it off and random apps he runs get killed randomly then it is
his fault, why should you care.
Whether it can be turned off, and how, depends on the OS---Linux
isn't the only one which overcommits. And a lot of Linux boxes
are running in situations where there isn't really a qualified
sysadmin, who can be presumed to know about such things. What
is the value set to by default on the distribution DVDs?
--
James Kanze