Stephen Hewitt wrote:
crashing is a feature.
and I provide that feature absolutely free with no hidden costs in all of my products. :laugh:
Stephen Hewitt wrote:
crashing is a feature.
and I provide that feature absolutely free with no hidden costs in all of my products. :laugh:
yes, it is a good alternative. One of the requirements of using it is that "You must have administrative privileges on the machine you are using". That should not be a problem in majority of cases though. second thing is it is "windows" specific. Exception handling is platform neutral. third thing is I never send data to microsoft website. however, if any of my fav. app crashes, i do send the crash dump to them. thanks for the info. btw.
yes, you are right but correct me if I am wrong. Windows 7 seems to be using lot of exception handling and displaying message about why it crashed with what error code. eg. in windows xp, if your explorer crashes, you get a message like "An unhandled win32 exception occured in explorer.exe".. but in windows 7, i hope you have observed it's different. they give you error message etc. You can argue that even information in latter case is not very helpful but in my experience, it is less annoying. same is the case with world's best browser ;) opera. whenever it crashes (once a year or two maybe.. to be honest, opera never crashed before v9. after that i think lot of advancements have made it complex, so it has started crashing once every 3 months or so), an option is provided to restart the browser, along with sending crash dump to opera where it is analyzed and the reason for crash is displayed to the user. In nutshell, exception handling when done properly can make your application more polite and responsible. If you are not handling exceptions and your application crashes without a hint, how the user will know which dump files to send to which address and in fact, will they ever bother to do it themselves? ;P
thanks for the detailed reply but for a lay user, crash is just an act of cheating by the application. if a software crashes 2-3 times, I normally uninstall it (except the windows OS and ibm rational clearcase coz' i do not hv options in these 2 cases) If one use catch all in main and then give some kind of error message to the user, that this module has failed. we're sorry. our chipmunks are running to solve your problem, then it is better. and regarding your stack trace, yes it can be very helpful if you can get the log but I dont know much about it. I think there are ways using SEH to get stack trace etc. anyway, you made a good point :))
One open source project whose author knows about try..catch blocks is this: 1. http://freshmeat.net/projects/ecasound[^] check ecasound-2.7.1\ecasound-2.7.1\Documentation\programmers_guide\ecasound_programmers_guide.txt (use of EH is very minimal here ut at least it exists) I will add more projects as and when I find them... have installed a catch(...) for all future source code checks. :laugh:
modified on Tuesday, June 29, 2010 9:21 AM
Can anyone point me to any open source application using exception handling? I have never used EH myself nor ever felt the need to use it. Just wondering what and when is the right use for it? I want to see how other ppl use exception handling in their code and how does it make their program robust? one good thing about EH is to quickly exit from deeply nested hierarchy. but how do experts use it? How often do you use EH in your code?
before reading your message, this elv had no idea how to swap row and colums. however, little goggling revealed the method. 1. select your range and click copy. 2. then click on paste special. a special dialog will open. check transpose and click ok. what macro would you use for same? I rarely use excel and my knowledge is limited to few formulas in it. but I know there's lot of programming capabilities in it.
isn't sprintf language specific? Unless the OP has very good knowledge of C or in case he is programming in some high level language like python, your answer will be greek to him. Consider explaining the 'optimized' algorithm of sprintf to him instead...
Pallini, help plz plz plz.. it's urgent urgent urgent. my program outputs garbage whenever I try to get the sqrt of -1 using squareroot function in Cmath moreover, plz explain why it's a unique value for every x,y. i feel it's value does not change with change in x & y. :^) Thanks for your inputs btw. :)
yes, sometimes all we want is to avoid using pair or map and use only an array. Why this question is so common is probably that this kind of situation occurs commonly. For me, it was just that I was solving a common grid problem in which every cell visited has to be marked and I wondered if I can just store a single no. in array to quickly check if that cell is already visited. Just like that as I said before :) Thanks for your answer btw.
Luc Pattyn wrote:
one could recurse and stuff the world into a single bit.
:laugh: funny. i have no such intentions. for me two 16 bit integers [screensize < 65536] into one 32 bit integer is cool enough.
Does that mean that if my range is two 32 bit integers, then I can store them in a 64 bit integer like this //say +ve integeres only. unsigned long long l; unsigned int a = SomeValue; unsigned int b = SomeValue; l = a | (b<<32) and store this l. Then while retrieving, a = l & 0xFFFFFFFF b = (l>>32) & 0xFFFFFFFF That's cool! thinking in terms of bits and informations helps :)
sorry, i did not mean to use f(x) + f(y) but f(x,y). my mistake. :( so what I want to know is if it is possible to convert 2 numbers into a single unique number so that instead of storing two numbers, I can store just one number. Then afterwards, while reading the stored data, I read one number and apply the inverse of f to get my two numbers x & y. say for eg. Z = 17*x^2 + y^2 for (x,y) = (3,4) Z = 17*9 + 16 = 169 to get x,y from 169, possible values will be x = [1,4,9]; equivalent y will then be = [153, 101, 16] since 16 is the only perfect square, so i get x=3, y=4. I was just wondering about this problem. It's not required in any practical application. So, you can assume that x,y belongs to a set of ALL POSITIVE INTEGERS only. or better 0<x<=y<10000 And order in which inputs are given does not matter. I hope I am clear now.
Given two integers, x & y, is it possible to tell a number Z such that Z = f(x,y) and Z is unique for all x,y? *Edit : f(x) + f(y) --> f(x,y)
modified on Saturday, May 15, 2010 11:04 AM
yeah, your suggestion is definitely worth a try. Thanks! :thumbsup:
I feel what he wants is to input two numbers n and m and the program should choose some numbers from series 1,2..n whose sum equals m and return all such combinations. For n=10, m=8, the possible combinations are: 1+7 2+6 3+5 .. 1+1+6 1+2+5 .. .. there can be a lot of such combinations. This is probably the ideal candidate for DP? 1. store all possible ways to make 1 using numbers from given series and store them 2. likewise all possible ways to make 2. since 2 can only be either using it alone or 1+1 and then to make 1, you already have ways stored during step 1 and so on for oher nos. for 3 = 3, 2+1. use info. for ways to make 2 and you'll automatically get 3, 2+1, 1+1+1 for 4 = 4, 3+1...
class A sealed
{
};
class B: public A
{
};
error C3246: 'B' : cannot inherit from 'A' as it has been declared as 'sealed' I use VS 2008.
Rajesh R Subramanian wrote:
I only have 2003 installed here on this PC and it doesn't just work right. I will be able to derive classes from a class that has been declared 'sealed'.
Do you mean your compiler recognizes sealed keyword, allows compilation etc and still do not stop you from inheriting? hmmm.. may be you should tweak around a bit to find out how 'sealed' is being interpreted by your VS compiler. In the msdn link I mentioned before, it is written sealed is valid even if /clr is not mentioned. So, my suggestion is not entirely wrong. It works in at least one case. :laugh:
Rajesh R Subramanian wrote:
Which means that it is not a C++ program! It is a C++/CLI program, that targets the .NET framework.
Now certainly, it's david vs big-fat-goliath(that's you) given my insufficient knowledge about managed or unmanaged code but man, if you do not scroll to the end of page, you will see this line "sealed is also valid when compiling for native targets (without /clr)" I have nothing more to say on this and whatever you say after that is correct but can you confirm this by using 'sealed' keyword in native unmanaged application on your system. I feel it's working on my PC. :)
okay.. Thanks for the information. Visual studio compiler supports this keyword [^] and above all,if a person happens to use VS, "it works" without "any additional implications". Making the c'tor private will certainly stop the class from being inherited but it will also force the person to provide 'other' way of creating the class object. I think OP wanted to stop inheriting not instantiation. And my suggestion only helped him do what he wanted - nothing more, nothing less. :)