|
Try with optimizations turned off.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
|
That's odd...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
In case you care, i did the testing, here are[^] the results.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
Yes, I can care.
Anyway I wouldn't use a debug build for a speed test.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Just for you ( ), here are the results of a release build with "default" optimization (for speed):
<1a> 0.0000022349 sec
<1b> 0.0000019556 sec
<2 > 0.0000019556 sec
----------
<1a> 0.0000016762 sec
<1b> 0.0000016762 sec
<2 > 0.0000016762 sec
----------
<1a> 0.0000016762 sec
<1b> 0.0000016762 sec
<2 > 0.0000016762 sec
----------
<1a> 0.0000016762 sec
<1b> 0.0000016762 sec
<2 > 0.0000019556 sec
----------
<1a> 0.0000016762 sec
<1b> 0.0000016762 sec
<2 > 0.0000019556 sec
and with optimizations turned off:
<1a> 0.7622823571 sec
<1b> 0.7618152586 sec
<2 > 0.5077494486 sec
----------
<1a> 0.7632852779 sec
<1b> 0.7537491497 sec
<2 > 0.5121279380 sec
----------
<1a> 0.7620644523 sec
<1b> 0.7755153239 sec
<2 > 0.5118524840 sec
----------
<1a> 0.7574504581 sec
<1b> 0.7570453787 sec
<2 > 0.5195719009 sec
----------
<1a> 0.7594526679 sec
<1b> 0.7610942173 sec
<2 > 0.5190137294 sec
[EDIT] I wonder where the "variance" of the time needed for the 2nd method comes from with optimizations applied.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
Thank you, sir.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi!
I want to write program like Nero express 8. Write Data CD|DVD program with Nero burn standard.It have multi session (CD empty & CD had data)
I use window XP & visual C 6.I want to this program run on window 7,XP.Help me !
I need code.I found but not found code & tutorial!
Thanks for good friends!!!
18/06/2010
Tuan,College 8,Ho Chi Minh City of Vietnam
|
|
|
|
|
tuan1111 wrote: I want to write program like Nero express 8.
The first thing you need to do is research how to transfer data from disk to DVD, a Google search will probably help you.
It's time for a new signature.
|
|
|
|
|
How pointless may be a request like: "Gimme code for duplicating the behaviour of an existing application?"
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
ShellExecute(NULL, _T("open"), _T("copy existing_application.exe my_application.exe"), NULL, NULL, SW_SHOW);
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
Check out IMAPI.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Im trying to pass more than one parameter which I transformed to a thread.
|
|
|
|
|
Since the thread function accepts a void * as argument (or type compatible with), you may pass a pointer to a whole struct of parameters.
Moreover, the thread functiom may access global variables (however, you shouldn't abuse of).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Try avoiding using globals at all costs. There are very few situations in which you have to use global variables.
|
|
|
|
|
I don't completely agree with you. It may be a quick good rule for the newbie. On the other hand the experienced may choose using globals (for instance in small, self-contained projects)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
You're right. I've reread my message and I sounded like such a Troll.
There are situations in which using globals is not a bad idea. If you have something like:
static const std::string application_name = "MyApplication";
passing it as a parameter is counter productive. So this is a situation in which you SHOULD use globals.
However, most times, passing variables as arguments rather than using globals is a better design choice.
|
|
|
|
|
Alternatively he can use static members of a class instead of "pure" globals, that "looks a bit more object oriented".
class CGlobals
{
public:
static int gGlobalInt;
static double gGlobalDouble;
static short gGlobalWarming;
};
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Computers don't kill programs, users kill programs <
> "It doesn't work, fix it" does not qualify as a bug report. <
|
|
|
|
|
Hi!
When I run my project, a window opens and immediately colses showing exception. When I break this exception, program control goes to a file called CEGUIDynamicModule.cpp. The output Window shows this:
'CricketGUI.exe': Loaded 'E:\CricketGUI\CricketGUI\Debug\CricketGUI.exe', Symbols loaded.
'CricketGUI.exe': Loaded 'C:\Windows\System32\ntdll.dll'
'CricketGUI.exe': Loaded 'C:\Windows\System32\kernel32.dll'
'CricketGUI.exe': Loaded 'E:\CricketGUI\CricketGUI\Debug\CEGUIBase_d.dll', Symbols loaded.
'CricketGUI.exe': Loaded 'C:\Windows\System32\winmm.dll'
'CricketGUI.exe': Loaded 'C:\Windows\System32\msvcrt.dll'
'CricketGUI.exe': Loaded 'C:\Windows\System32\user32.dll'
'CricketGUI.exe': Loaded 'C:\Windows\System32\gdi32.dll'
'CricketGUI.exe': Loaded 'C:\Windows\System32\advapi32.dll'
'CricketGUI.exe': Loaded 'C:\Windows\System32\rpcrt4.dll'
'CricketGUI.exe': Loaded 'C:\Windows\System32\ole32.dll'
'CricketGUI.exe': Loaded 'C:\Windows\System32\oleaut32.dll'
'CricketGUI.exe': Loaded 'C:\Windows\System32\oleacc.dll'
'CricketGUI.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.debugcrt_1fc8b3b9a1e18e3b_9.0.21022.8_none_96748342450f6aa2\msvcp90d.dll', Symbols loaded.
'CricketGUI.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.debugcrt_1fc8b3b9a1e18e3b_9.0.21022.8_none_96748342450f6aa2\msvcr90d.dll', Symbols loaded.
'CricketGUI.exe': Loaded 'E:\CricketGUI\CricketGUI\Debug\CEGUIIrrlichtRenderer_d.dll', Symbols loaded.
'CricketGUI.exe': Loaded 'E:\CricketGUI\CricketGUI\Debug\Irrlicht.dll', Binary was not built with debug information.
'CricketGUI.exe': Loaded 'C:\Windows\System32\opengl32.dll'
'CricketGUI.exe': Loaded 'C:\Windows\System32\glu32.dll'
'CricketGUI.exe': Loaded 'C:\Windows\System32\ddraw.dll'
'CricketGUI.exe': Loaded 'C:\Windows\System32\dciman32.dll'
'CricketGUI.exe': Loaded 'C:\Windows\System32\setupapi.dll'
'CricketGUI.exe': Loaded 'C:\Windows\System32\dwmapi.dll'
'CricketGUI.exe': Loaded 'C:\Windows\System32\shimeng.dll'
'CricketGUI.exe': Loaded 'C:\Windows\System32\apphelp.dll'
'CricketGUI.exe': Loaded 'C:\Windows\AppPatch\AcLayers.dll'
'CricketGUI.exe': Loaded 'C:\Windows\System32\shell32.dll'
'CricketGUI.exe': Loaded 'C:\Windows\System32\shlwapi.dll'
'CricketGUI.exe': Loaded 'C:\Windows\System32\userenv.dll'
'CricketGUI.exe': Loaded 'C:\Windows\System32\secur32.dll'
'CricketGUI.exe': Loaded 'C:\Windows\System32\winspool.drv'
'CricketGUI.exe': Loaded 'C:\Windows\System32\mpr.dll'
'CricketGUI.exe': Loaded 'C:\Windows\System32\imm32.dll'
'CricketGUI.exe': Loaded 'C:\Windows\System32\msctf.dll'
'CricketGUI.exe': Loaded 'C:\Windows\System32\lpk.dll'
'CricketGUI.exe': Loaded 'C:\Windows\System32\usp10.dll'
'CricketGUI.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.6002.18005_none_5cb72f96088b0de0\comctl32.dll'
Irrlicht Engine version 1.7.1
Microsoft Windows Vista Professional Service Pack 2 (Build 6002)
'CricketGUI.exe': Loaded 'C:\Windows\System32\uxtheme.dll'
First-chance exception at 0x7608fbae in CricketGUI.exe: Microsoft C++ exception: CEGUI::GenericException at memory location 0x002bd0f4..
Unhandled exception at 0x7608fbae in CricketGUI.exe: Microsoft C++ exception: CEGUI::GenericException at memory location 0x002bd0f4..
How to solve this exception and run my application?
|
|
|
|
|
have you tried single step debugging/tracing it and/or logging information ?
'g'
|
|
|
|
|
I have no idea what the library you're using is doing, but have you looked up the documentation for that exception and found what sort of thing is happening when it's thrown?
Perhaps catch the exception and have a look and see if there's any hints as to what caused it? Has it a message function that'll give you a clue as to what happened? Line number of file information as to where it happened?
Cheers,
Ash
|
|
|
|
|
|
Hi,
Does anyone know if there's a built in function in c++ or mfc in which you can pass a double or long double and declare how many places you'd like the value to be rounded to? For example, pass it 12.125 and n=2 decimal places, and out comes 12.13, etc.
Thanks!
P.S. Formatting the values during cout won't work for me, I need to store the rounded values in a new variable.
|
|
|
|
|
I don't do a lot of numeric stuff anymore so take this with a pinch of salt.
First off I don't know any C++ standard library facilities that would help. C had floor and ceil which take doubles and return an integer either truncating the value or rounding up to the next highest number. With these and pow you can write something that'll be good enough for most things.
Off the top of my head it'd look like:
double round_to( double number, unsigned number_of_decimal_places )
{
double exponent( pow( 10, number_of_decimal_places ) );
number *= exponent;
number += 0.5;
return floor( number ) / exponent;
}
which is a bit cheesy - it won't work for negative numbers or any number that causes the line with the "disaster line!" comment to overflow an integer. However they might give you a handle if no one comes up with a better idea!
Cheers,
Ash
Edited to remove a spurious brace...
modified on Friday, June 18, 2010 3:52 PM
|
|
|
|
|