exception and global variable

G

George2

Hello everyone,


Bjarne mentioned in his book, that there is no way to catch exceptions
from the initialization of global variables (section 14.7). But I do
not think it is true, because we can add function try block to its
constructor, and catch appropriate types of exceptions or using
catch(...) to catch all exceptions.

Am I correct? Any comments?


thanks in advance,
George
 
A

Alf P. Steinbach

* George2:
Bjarne mentioned in his book, that there is no way to catch exceptions
from the initialization of global variables (section 14.7). But I do
not think it is true, because we can add function try block to its
constructor, and catch appropriate types of exceptions or using
catch(...) to catch all exceptions.

Am I correct? Any comments?

Depends what you mean by "catch".

In a function try-block you can choose to throw some other exception, or
the original, but throw you must -- or else it's done automatically.

So a function try-block doesn't stop the exception: you can in one sense
"catch", but you can't safely "get rid of", because that exception has
an absolutely irresistible urge to move onward, it's a tiger that's very
set on burrowing its fangs in your neck, once it recognizes that it's in
your proximity. In order to prevent that you can use devious trickery
or absolute destruction. Trickery: fool that tiger into believing it's
not yet reached you, by way of never escaping from that catch clause,
just calling something that continues doing what the program does, in
essence riding the tiger, which is dangerous and not recommended.
Absolute destruction: terminate. But in the general sense of catching
the exception and moving on with normal business & life, no you can't.


Cheers, & hth.,

- Alf


PS: George, can you please start giving references to your quotes and
paraphrases? Bjarne has written many books. With many editions.
 
E

Erik Wikström

* George2:
[...]

PS: George, can you please start giving references to your quotes and
paraphrases? Bjarne has written many books. With many editions.

I am still amazed at the number of people who seem to think that George2
is reading the replies but I am quite convinced that he is not aware
that the message is posted in here.

Of course, there is nothing wrong with answering the questions, since
there might be others who are interested in the answer.
 
A

Alf P. Steinbach

* Erik Wikström:
* George2:
[...]

PS: George, can you please start giving references to your quotes and
paraphrases? Bjarne has written many books. With many editions.

I am still amazed at the number of people who seem to think that George2
is reading the replies but I am quite convinced that he is not aware
that the message is posted in here.

Sorry, I'm stoopid. Please explain. I mean, I don't understand how
he/she can be posting here without being aware of that, except if you
have someone noticed massive multi-posting => trolling?

Of course, there is nothing wrong with answering the questions, since
there might be others who are interested in the answer.

Ah.


Cheers,

- Alf
 
E

Erik Wikström

* Erik Wikström:
* George2:
[...]

PS: George, can you please start giving references to your quotes and
paraphrases? Bjarne has written many books. With many editions.

I am still amazed at the number of people who seem to think that George2
is reading the replies but I am quite convinced that he is not aware
that the message is posted in here.

Sorry, I'm stoopid. Please explain. I mean, I don't understand how
he/she can be posting here without being aware of that, except if you
have someone noticed massive multi-posting => trolling?

All questions posted by George2 in c.l.c++ are also posted in

- ms.p.vc.language under the name George)
- ms.p.win32.programmer.kernel under the name George George

and perhaps in a few other groups that I do not know of, but it is only
in ms.p.vc.language that he is actively discussing the subjects (I have
not seen him respond to a single reply in c.l.c++). Since he do seem to
be serious in ms.p.vc.language I doubt that he is a troll, and he would
have to be a super-idiot to not get the hint when people keep telling
him that his questions are off topic (see his taskmanager/virtual memory
questions earlier).

If he is not a super-idiot then I do not see why he would keep posting
questions to a group he is not reading unless he is simply unaware of
the fact that he is posting in it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,744
Latest member
CortneyMcK

Latest Threads

Top