Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
Search the Tips
Tip Bank > Testing and QA > Profiling

Profiling - Page 3

41-60 of 80     Previous     Next
Ambiguous Operator Error
by DevX Pro
My small program (see below) below compiles and runs correctly on one machine and generates the following error on another: 'operator Both computers are running Windows NT 4 Service Pack 4, Microsoft Visual Studio C++ v.6. Could you please tell me where the source of this problem could be? Tools | Options | Directories Tab and Tools | Options | Help System Tab of MS Visual C++ Studio have the same settings on both computers. */ #include #include #include using namespace std; class Event{ friend ostream &operator pq; pq.push(e1); pq.push(e2); while(!pq.empty()) { cout error C2248: 'eT' : cannot access private member declared in class 'Event' see declaration of 'eT' error C2248: 'pT' : cannot access private member declared in class 'Event'
Compiler Warnings with STL Map Containers
by DevX Pro
Using even the most basic default constructor, such as " mapm; " , causes a debug error creating huge compiler warnings in Visual C++ and MS Visual Studio 6.0. That one line alone causes 6 warnings and the small sample program below ultimately creates a total of 19 warnings. The code executes without further incident but the unresolved warnings trouble me. In essence, the compiler warnings indicate that the debugger continues to append class names into long command lines that eventually exceed the 255-character limitation. The suggested resolution, substituting a 1-character name for the class name during debug time, does not work. Is there a fix? #include #include #include using namespace std; class classic { long account; char descrip[50]; public: classic (); classic (int yr, char *who_or_what); ~classic (); void show_list (); int get_val () const; bool target (int low, int hi); friend ostream &operator= low && account (const classic &item1, const classic &item2) { return item1.get_val() > item2.get_val(); } bool operator== (const classic &item1, const classic &item2) { return item1.get_val() == item2.get_val(); } bool operator!= (const classic &item1, const classic &item2) { return item1.get_val() != item2.get_val(); } // --------------------------// int main() { int accts = 0; cout line; // Fill the map line.insert( pair( long(10000), classic(10000, "Sandal Accounts")) ); line.insert( pair( long(10500), classic(10500, "Slipper Accounts")) ); line.insert( pair( long(21000), classic(21000, "Women's Shoe Accounts")) ); line.insert( pair( long(31000), classic(31000, "Men's Shoe Accounts")) ); line.insert( pair( long(50500), classic(50500, "Boot Accounts")) ); // Display map data map::iterator p; accts = line.size(); cout second.show_list(); cout second.show_list(); cout second.show_list(); p++; } return 0; }
Memo Fields in FoxPro for DOS
by DevX Pro
I am working on a FoxPro for DOS system and I am using the COPY TO function to export the DBF to a (text or Microsoft Excel) file. However, the information contained in the Memo fields does not get exported. Why is this? How can I get around this?
Default Arguments to Functions
by DevX Pro
Is it considered acceptable to use default argument initializers both in a definition of a function (e.g., void foo(int x =10) {...}) as well as its declaration? Stroustrup, in his only example, does not, but it seems reasonable and conforms to the grammar, doesn't it? I've wondered about this because g++ (2.8.1) behaves strangely for member function definitions with default arguments. If they are actual ints (like 0) or global variables, it is fine, but if they are const ints, it complains about an inconsistency (!).
Implicit Function Declaration
by DevX Pro
I am a Computer Science student, and I am trying to compile a program where I use multiple files and my own header file for the first time. But I'm having some trouble. I get an error that says: driver.cc: In function `int main(...)': driver.cc:34: warning: implicit declaration of function `int dev(...)' driver.cc:35: warning: implicit declaration of function `int output(...)' I thought this meant that the function was not defined anywhere else, but I thought the header file and attached file with the definitions did that. Do you know what I am doing wrong?
The Memory of an Exception Object
by Danny Kalev
The memory for the temporary copy of an exception that is being thrown is allocated in a platform-defined way. Note, however, that it may not be allocated on the free store, and in general, such ...
Add a catch(...) Statement to Your Exception Handlers' Hierarchy
by Danny Kalev
If your application uses exception handling, it is recommended that you always add a catch(...) statement after all the existing catch statements. Remember that even if your code contains the ...
Inheritance and Memory Allocation
by DevX Pro
I can't create an instance of the derived class using operator new. The base and the derived classes differ only by a virtual function. The error messages I receive at runtime asks me to specify the path for files like: new.asm, strncpy.asm
Lazy Versus Eager Instantiation
by Behrouz Fallahi
There are techniques for creation of objects (read allocation of ...
Catch Exceptions by Reference
by Danny Kalev
Although you can catch an exception by value, as in the following ...
Understanding Resumptive and Non-Resumptive Exception Handling Models
by Danny Kalev
The C++ exception handling model is non-resumptive. In a resumptive model, after an exception has been handled, the program continues execution at the point where the exception was thrown. In C++, ...
Do Not Use Operator New in a Throw Statement
by Danny Kalev
Dynamic allocation of an exception (as in this example) is not a good ...
Optimize With the Named Return Value
by Danny Kalev
The named return value is an automatic optimization that a compiler applies in order to eliminate the construction and destruction of a temporary object. When a temporary object is copied to another ...
Unwinding the Stack
by Danny Kalev
When an exception is thrown, the runtime mechanism first searches for an appropriate handler (a catch statement) for it in the current scope. If such a handler does not exist, the current scope is ...
Improve Loop Performance
by Brett Spell
It's often the case that you'll use some derived value in the test section of a for loop. Many times this value will not be changed during the loop, such as in this ...
Exceptions During Object Construction Don't Cause Memory Leaks
by Danny Kalev
Operator new performs two operations: it allocates memory from the free store, and it constructs an object on the allocated memory. The allocated memory doesn't leak when an exception is thrown ...
Empty Exception Specification
by Danny Kalev
Some programmers tend to add an empty exception specification to constructor destructor, assignment operator, and copy constructor of a ...
Exception Type Match
by Danny Kalev
When an exception is thrown, the exception handling mechanism searches for a matching handler for it. The matching rules for exceptions are more restrictive than the matching rules for function ...
Ensuring Proper Cleanup in the Case of an Uncaught Exception
by Danny Kalev
It is implementation-dependent whether the destructors of local objects are invoked when an uncaught exception occurs. To ensure that destructors of local objects are invoked in this case, you can ...
Exception Handling Misuses
by Danny Kalev
Exceptions can be used as an alternative control structure in addition to for-loops or while-blocks. For example, you can use exceptions to implement a simple application that prompts the user to ...
41-60 of 80     Previous     Next
Sitemap