I am curious, since my c++ is quite rusted, how do you acquire a resource that can throw upon initialization in c++ ?
You use a try.. catch block. However, that is completely unrelated to specifying the life-time of the object and can be set at a higher level, possibly even in main().
Or is checked exception usage is discouraged in c++ ?
There are no checked exceptions in C++. There are exception specifications but they were a bad idea that got deprecated in C++11.
OK, let's spell it out then. You said: It's better to close your files and connections, but they'll be garbage-collected for you if you don't.
Now, riddle me this: what guarantee do you have that the GC will run at all? If the GC decides that your program has enough available memory it may never run, it will just sit there waiting for some threshold while your program merrily consumes scarce resources that it knows nothing about.
I can't speak for.net, but in Java you have very little need for it. It's better to close your files and connections, but they'll be garbage-collected for you if you don't.
Some applications interact with garbage collection by using finalization and weak/soft/phantom references. These features can create performance artifacts at the Java programming language level. An example of this is relying on finalization to close file descriptors, which makes an external resource (descriptors) dependent on garbage collection promptness. Relying on garbage collection to manage resources other than memory is almost always a bad idea.
There are some realy good cops. My brother-in-law is an a copy in my hometown, a smallish city. [rest of story snipped for brevity]
I beg to differ.
A good cop is one that protects the populace against criminal elements, including his or her fellow cops. For example, a good cop will arrest a police officer that commits a crime.
A good cop is one that upholds the laws, impartially, including cases when the laws are broken by his or her fellow cops. For example, a good cop will ticket a police officer that speeds.
Unfortunately, there is no such thing. A "good cop" is as real as the tooth fairy, your belief in your brother in law's virtues notwithstanding. Some people say that "a good cop is a dead cop" and I agree, but not for the reason you think. Any cop who really tries to be a good cop will have an "accident" arranged by some of their "fellow" cops that will quickly persuade them to fall in line, leave the force and emigrate or permanently stop breathing.
But why not? It seems quite reasonable for parties to be allowed to come to an agreement without having to be involved in a court case.
In a perfect world, yes.
In real life, however, justice became an expensive commodity which not everybody can afford. If settling is cheaper than winning then it should be outlawed as extortion.
If you had hired a competent lawyer then the lawyer could have forced the company to produce the contract. (And forced the judge to play by the rules.)
And that is exactly the reason why everybody(*) hates lawyers: they preserve and perpetuate a system where you cannot get justice, you must purchase it.
I want to buy some stock and willing to pay, say up to $1/share. Somebody is willing to sell me that stock for, say as low as $0.99/share. Hey, I'd gladly pay $9.90 as it's less than my limit, but as soon as the order is sent, some HFT algorithm gets in before me, snatches the stock at $0.99 and resells it back to me at $1.00
P.S. There is a good ending to this story: follow the links to the blog of Neil Fraser, a Google engineer who bailed the guy out after he spent seven months in jail, accused of, since video recording police is not illegal... "attempted lynching"....
This is not a good ending. In fact, it is a terrible ending: jackbooted thugs get to walk all over a person, hold him prisoner for eight months, violate his rights, harass his family and destroy/confiscate his property -- with impunity.
A good ending would be if the policemen, the prosecutor(s), the DA and everybody else participating in this travesty of justice were actually lynched.
We're going about this the wrong way. We should all buy copies of the game and then return it the next day because it won't play without the internet. That will cost Ubisoft thousand of dollars handling returns / RMA's from their various vendors and send a clear message about the DRM.
Thousands of dollars, huh?
Ubisoft financial data for 2010: Revenue: Euro 971 million Operating income: Euro 260 million Net income: Euro 89.8 million
They return to using the same harebrained DRM scheme, we return to boycotting it. Why does UBI think it will be different this time? That we somehow magically now accept that kind of crap?
Who exactly is this mythical "we"? What percentage of their customers do you think will care enough to boycott?
Face it, boycotts only work against small local companies.
You use a try .. catch block. However, that is completely unrelated to specifying the life-time of the object and can be set at a higher level, possibly even in main().
There are no checked exceptions in C++. There are exception specifications but they were a bad idea that got deprecated in C++11.
RAII does not require the consumer of a class to wrap the object in a try block.
what do you propose instead ?
How should I know? I use C++ for my day job, not Java.
Sounds luke the C# using statement and the corresponding IDispose interface.
Which is a bass akwards way of doing things, as it makes proper object cleanup the responsibility of the object's user.
OK, let's spell it out then. You said: It's better to close your files and connections, but they'll be garbage-collected for you if you don't.
Now, riddle me this: what guarantee do you have that the GC will run at all?
If the GC decides that your program has enough available memory it may never run, it will just sit there waiting for some threshold while your program merrily consumes scarce resources that it knows nothing about.
Not according to the Java documentation:
Some applications interact with garbage collection by using finalization and weak/soft/phantom references. These features can create performance artifacts at the Java programming language level. An example of this is relying on finalization to close file descriptors, which makes an external resource (descriptors) dependent on garbage collection promptness. Relying on garbage collection to manage resources other than memory is almost always a bad idea.
Also, for the fun of it, look at:
http://stackoverflow.com/questions/6470651/creating-a-memory-leak-with-java
I beg to differ.
A good cop is one that protects the populace against criminal elements, including his or her fellow cops. For example, a good cop will arrest a police officer that commits a crime.
A good cop is one that upholds the laws, impartially, including cases when the laws are broken by his or her fellow cops. For example, a good cop will ticket a police officer that speeds.
Unfortunately, there is no such thing. A "good cop" is as real as the tooth fairy, your belief in your brother in law's virtues notwithstanding. Some people say that "a good cop is a dead cop" and I agree, but not for the reason you think. Any cop who really tries to be a good cop will have an "accident" arranged by some of their "fellow" cops that will quickly persuade them to fall in line, leave the force and emigrate or permanently stop breathing.
Good cops are like spider-man in two ways:
1) They are ware that with great power there must also come great responsibility.
2) They do not exist.
Would that be a battle of twits?
Driver: What's the problem?
Car: I think you know what the problem is just as well as I do.
I think that you'll find the 5th of November more interesting than you suspected.
You could see his face while he typed it? I had no idea that our privacy eroded that much.
In a perfect world, yes.
In real life, however, justice became an expensive commodity which not everybody can afford. If settling is cheaper than winning then it should be outlawed as extortion.
I think you meant a laciar steleotype.
It seems that somebody went to some trouble (not to mention monetary expense) just to tell her "have a nice day".
And that is exactly the reason why everybody(*) hates lawyers: they preserve and perpetuate a system where you cannot get justice, you must purchase it.
(*) Possibly excluding lawyers
I want to buy some stock and willing to pay, say up to $1/share.
Somebody is willing to sell me that stock for, say as low as $0.99/share.
Hey, I'd gladly pay $9.90 as it's less than my limit, but as soon as the order is sent, some HFT algorithm gets in before me, snatches the stock at $0.99 and resells it back to me at $1.00
He's also right.
Where's the added value?
This is not a good ending. In fact, it is a terrible ending: jackbooted thugs get to walk all over a person, hold him prisoner for eight months, violate his rights, harass his family and destroy/confiscate his property -- with impunity.
A good ending would be if the policemen, the prosecutor(s), the DA and everybody else participating in this travesty of justice were actually lynched.
Thousands of dollars, huh?
Ubisoft financial data for 2010:
Revenue: Euro 971 million
Operating income: Euro 260 million
Net income: Euro 89.8 million
Yup, that will show them!
Who exactly is this mythical "we"?
What percentage of their customers do you think will care enough to boycott?
Face it, boycotts only work against small local companies.
Thanks for your post.
Several things:
1. I'd say that at this time, the Dev Team is more damaging than contributing to the continuing existence of Nethack.
2. Why do you say that Sporkhack is no longer developed?
There are several things you should be aware of:
1. Google is evil, and will continue being evil because, contrary to what you think:
2. For a mega-corporation, being evil makes good business sense.
Enlighten me. I'll apologize.
How many tanks do you need to deter a possible attacker?
Come to think of it, who would that attacker be?