Browse DevX
Sign up for e-mail newsletters from DevX

Search the Tips
Tip Bank > C++ > Profiling

Profiling - Page 2

21-40 of 80     Previous     Next
Error 2374 for loop-scoped variable declaration
by DevX Pro
The following code produces an error when compiled on Microsoft Visual C++ 6 SP3: for (int i = 0; i error C2374: 'i' : redefinition; multiple initialization But it compiles cleanly on gcc. Why? Which interpretation of the language specification is correct?
Function to create a folder/subfolder
by DevX Pro
How can I write a function in C++ that would create a folder/subfolder on the hard-disk?
Floating Point Arithmetic Myths
by Danny Kalev
In the olden days, the use of floating point numbers imposed a significant computation and speed overhead compared to integer arithmetic. For this reason, many optimization guidebooks and IT veterans ...
Optimize Your Application by Reducing Its Size
by Danny Kalev
A CPU cycle is roughly equivalent to the time needed for performing one instruction. On modern CPUs, a cycle takes about a nanosecond. In other words, a Pentium III 900 can perform about one billion ...
Clearing the Screen
by DevX Pro
What is the "clear screen" function in C++, and which library is it in?
Authentication Error When Creating a Web Application
by Manoj K.
If you are using a numeric IP address instead of a computer name to identify your Web server when creating an application, you may encounter an authentication error. This happens when your ...
Avoid Hard Carriage Returns in Your HTML Text Strings
by Manoj K.
When using the element property innerHTML to change the text of an element, make sure that you don't put hard carriage returns inside of the text string. Doing so will cause an "Unterminated ...
Remove "Dead Declaration" From Your Code
by Danny Kalev
Applications constantly undergo modifications, bug fixes, and customization. Programmers often remove pieces of obsolete code that use a variable while leaving the declaration of that variable intact.
Playing Sound Files in FoxPro Apps Quickly
by DevX Pro
I write language instruction programs and have been calling mplayer2 to allow students to hear the pronunciation saved in recorded sound files. But mplayer takes forever to load and play. So do all the other executable programs that I have, such as xrecord. By contrast, Windows can play .wav files instantly. If I could load and play small .wav files that fast I could greatly improve my language program. (There must be some subfile of Windows that plays its sound files so quickly.)What other .exe files are there that load and play very quickly under FoxPro? Using verbs in FoxPro is even slower than calling .exe files for some reason.
Optimizing Java Code
by C.V. Ram
Developers should realize that only a few optimizations are supported by most Java compilers. That most Java compilers do little when it comes to optimizing code may be surprising, but that is a fact.
Patch for Divide-By-Zero Error
by DevX Pro
We are getting a divide-by-zero error running FoxPro for Windows 2.5 on a Novell server on the network on an NT workstation. Can I use the patch in version 2.5?
Using the Assert Macro
by DevX Pro
I am not sure if it is good when I use the assert macro in the following code: int sum(int number) // Precondition: number => 1 // Postcondition: return sum from 1 to n terms { assert(number >= 1); int total = 0; for (;number >= 1; number--) { total = total + number; } return total; } What do you think?
The First Rule of Code Optimization
by Danny Kalev
I recently received a question from a reader who asked how to sort a large file. My solution was based on the qsort() algorithm, which is the only sorting algorithm defined by ANSI C. Another reader ...
The 80-20 Optimization Rule
by Danny Kalev
It's a fact that applications spend 80 percent of their time executing 20 percent of their code. Some even claim that the ratio is higher: 90-10. Usually, programmers can't assess the performance ...
Optimizing Nested Loops
by Danny Kalev
Several compilers need this hint from the programmer while others are clever enough to figure it out automatically. ...
Menus Using Virtual Functions
by DevX Pro
What is giving me a redefinition of CMenuItems class error in this code? //cmenu.h class CMenuItem { public: char title[81]; virtual void Do_Command(void)=0; }; //********************* //CMDS.CPP Defines and initializes menu commands. #include #include #include "cmenu.h" class CMenuBell:public CMenuItem{ void Do_Command(void); }; class CMenuSaying:public CMenuItem{ void Do_Command(void); }; class CMenuAdd:public CMenuItem{ void Do_Command(void); }; void CMenuBell::Do_Command(void){ putc('\007',stdout); // "\007" rings a bell } void CMenuSaying::Do_Command(void){ puts("If you know the meaning of the universe,"); puts("Make the sound of one hand clapping."); } void CMenuAdd::Do_Command(void) { double x,y; printf("Enter a number: "); scanf("%lf",&x); printf("Enter a number: "); scanf("%lf",&y); printf("The total is %f.", x+y); } int num_commands; CMenuItem *commands[20]; void Init_Commands(void) { commands[0] = new CMenuBell; strcpy(commands[0]->title, "Sound a bell."); commands[1] = new CMenuSaying; strcpy(commands[1]->title, "Print a message."); commands[2] = new CMenuAdd; strcpy(commands[2]->title, "Add two numbers."); num_commands=3; } //************************ //Main.cpp #include #include "cmenu.h" #include "CMDS.cpp" extern int num_commands; extern CMenuItem *commands[]; void main(void) { int i, sel; Init_Commands(); do { puts("\nMENU:\n"); for (i=0; ititle"); printf("\nEnter a selection: "); scanf("%d", &sel); if (sel>0 && selDo_Command(); } while (sel
Where Are Exception Objects Stored?
by Danny Kalev
Consider the following ...
Rules of Thumb for Designing Exception Classes
by Danny Kalev
< ...
Passing a Variable to a Compiled Program
by DevX Pro
I am calling an .FXP from a batch file, but would like to pass a variable. Am I able to do this? How would FoxPro recognize it?
File Locations
by DevX Pro
I have set Home as C:\MyApp in Project Information. VFP has no problem finding the project, but when I do a build and, while running, click a link to a form, it wants to look in the VFP directory or, since I put SET DEFAULT TO C:\MyApp in main form Activate code, it wants to look there instead of in: C:\MyApp\Forms. Doesn't VFP know to look in a Forms subdirectory for a form? I want the application to find each component (form, database, report, etc.) based on setting a single "Application Home Directory" so that when I deploy it to the target PC, I only need to change a single location setting. Is this possible? I want the application to find each component (form,database,report,etc.) based on setting a single 'Application Home Directory' so that when I deploy it to the target PC, I only need to change a single location setting. Possible?
21-40 of 80     Previous     Next
Thanks for your registration, follow us on our social networks to keep up-to-date