- where are the planes at the start: somewhere at the airport, at a runway, or in the air?
- what are the times when planes are scheduled to arrive or take off? If not times, what is the order? If not order, is there any other restriction about the sequence?
- what does delay(?) time mean for a plane? Is it the maximum time it can wait at the airport, or remain in the air? If so, when does the time start counting? Or does that time only start ticking when on a runway?
- what does delay(?) time mean for a runway? What is it's effect? When does it start?
- what do you mean by runway capacity? Typically I'd say the capacity of any runway is exactly 1, as there can't be two planes on the same runway at the same time! But clearly you mean something else. Explain!
- the goal is to optimize a time for the airport - which time is that?
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
The Master said, 'Am I indeed possessed of knowledge? I am not knowing. But if a mean person, who appears quite empty-like, ask anything of me, I set it forth from one end to the other, and exhaust it.'
― Confucian Analects
I need to multiply integer value with a factor and want to do an overflow check with INT_MAX, INT_MIN for this.
Integer contains 4 bytes on my machine an this is the max variable-size.
I need to do this check for signed integer and unsigned integer. Only integer math/variables allowed.
The factor always comes as fraction with a nominator and denominator. The denominator always is 10
Factor might be greater 1 or less than 1
So for example fraction is 25/10, varible a is signed integer
a = (a * 25)/10 -> may cause overflow, because (a * 25) can be > INT_MAX ( or < INT_MIN )
if (a > (INT_MAX * 10)/25 -> not possible because of overflow, INT_MAX is the maximum number the compiler can store.
if (a > INT_MAX * (10/25) -> not possible because 10/25 is 0.4 which will be 0 in integer math.
So any idea how to solve my problem?
Thanks for any hint!
It will take more effort and cpu cycles to pick off the overflow than simply move it to next size up integer, do the mult on a that type and look at the result for overflow
So for 16 bit int and 32bit long as an example
long b = a;
if (b & 0x7FFF0000 != 0)
// error result in b is larger than an int
a = (int) b;
If you want to do it proper anal uses standard ints
int16_t a = ????;
int32_t b = a;
if (b & 0x7FFF0000 != 0)
// error result in b is larger than an int
a = (int16_t) b;
I linked only part of the /lib folder , my mistake.
Still like to know if my original question - linking to network resource is feasible.
This is basically result of my inability to ".configure" for non - native architecture.
The "configure" kept asking for dependency after dependency.
So I ended up running .configure on required architecture.
After a detour I am back to tying to implement / crosscompile C++ code.
I can option a prefix for desired architecture , but still having an issue linking to specific desired architecture libraries.
I was unable to use ".configure " to create correct foreign architecture library on "local" architecture.
I did a hack by copying an entire "foreign" folder to local device and was partially successful linking to it.
Still missing some library and could do same hack.
Is there a more "elegant" way to accomplish that?
Here is what is still failing to link correctly.
Sorry for the mess.
System.Windows.Markup.XamlParseException: ''The invocation of the constructor on type 'CommonXFS.Interface.Utility.MainWindow' that matches the specified binding constraints threw an exception.' Line number '5' and line position '9'.'
FileNotFoundException: Could not load file or assembly 'Interop.NXCameraXLib.1.0, Version=188.8.131.52, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
IS there a way to return from DoModal without having a PUSH BUTTON with the value of IDOK ,IDCACEL or IDABORT I would like to have 3 radio buttons specifying 3 choice and return the value of one of those to DoModal
Is there a way to return from DoModal without having a PUSH BUTTON with the value of IDOK?
You would need to call the EndDialog function with the second argument set to the ID of your radio button. If you are not using Windows API and are using MFC instead... you would call CDialog::EndDialog
My DoModal is being called from
My CMainFrame once returning to DoModal via EndDialog the Dialog box is destroyed but the class/object is still around ( I created the modal Dialog on the stack ) so the data in the class is still available until I exit the CMainFrame Routine
Also the only way to have a bad return code from UpdateData is to call pDx->fail which has the side effect of an exception which I would have to delete. if everything is okay I just call EnDialog notifying the CMainFrame which called DoModal of my selection
Also the only way to have a bad return code from UpdateData is to call pDx->fail which has the side effect of an exception which I would have to delete. if everything is okay I just call EndDialog notifying the CMainFrame which called DoModal of my selection
OK, let me know if you have any problems here. But from what you've described it sounds like the desired outcome.
only one Issue UpdateData seems to always return TRUE
That means UpdateData() succeeded. Can you explain to me why you need UpdateData to fail?
even if I call pDX->fail
With my experience I am going to make a strong inference that your pDX variable is a pointer to a CDataExchange object. Can you explain to me why you need this to fail? If this fails a runtime error will be thrown... I can't even think of a valid reason you would want this.
The source for UpdateData() is inside wincore.cpp and you will find that the UpdateData() function constructs a new CDataExchange object and attaches it to your Cwnd object and performs DDX through there.
In other words... your line of code inside your class:
pDX->Fail(); // This fails because it's a pointer to another CDataExchange object.
You should to open [Your Visual Studio Path]\VC\atlmfc\src\mfc\wincore.cpp and scroll down to the Updatedata() implementation where you will immediately understand why UpdateData() always returns TRUE; It creates a new CDataExchange object inside the function. You cannot force UpdateData() to fail by manipulating an external object.
I've been meaning to tell you that I am happy to see you have finally moved over here from CodeGuru. I followed Chris over to his new site some 18+ years ago soon after Zafir Anjum sold codeguru and I rarely go back to the old site anymore.
Victor Nijegorodov wrote:
Why do you need the UpdateData at all? There was a great essay about Avoid UpdateData of Joe Newcomer. I'd recommend you to check it out!
Actually in this case he may need to call UpdateData() because he is bypassing both the CWnd::OnOk and also exiting the dialog with EndDialog(SOME_RADIO_ID); With that knowledge go and read the final two paragraphs in the debate between Doug Harrison and Dr. Newcomer.
If we are going to suggest that the poster "ForNow" avoid using UpdateData() then we need to ensure that he is using control variables.
I haven't used MFC in nearly 10 years, not sure why I even remember these things.
Last Visit: 20-Jan-20 14:34 Last Update: 20-Jan-20 14:34