|
Hi toxcct,
Method seems to be static
No he is calling them using class
Regards,
Sandip.
modified on Wednesday, September 24, 2008 7:18 AM
|
|
|
|
|
I am bit confused is there any difference between two methods.
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|
|
don't you see the constness of the second definition ?!
|
|
|
|
|
Mahesh Kulkarni wrote: any difference between two methods.
Difference is const
Regards,
Sandip.
|
|
|
|
|
The compiler can't decide whether you want the const or non-const function invoked. Saying you want the non-const explicitly should do the trick.
const std::string SwitchName = SignalNode->getName();
osg::Switch* SignalSwitch = dynamic_cast<osg::switch*>((osg::Switch*) NodeCollector::GetSwitch(SwitchName));
Hope it works.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
|
It might help the const ness experts to solve your issue if you say which compiler version you're using. VC6 treats const parameter type matching quite differently from, for example, VS2005.
Is there any difference between what the 2 functions actually do?
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|
|
Why none of us noticed that he is calling non static methods using class..
Regards,
Sandip.
|
|
|
|
|
Hello everyone,
1.
Sometimes in x64 release code (optimized to full level), even if we defined some global data, variables or member variables for some data structures, we can not see the actual value in debugger. The related error message is -- "Error: expression cannot be evaluated".
I think it is because of x64 code optimization to remove some variables or changed code execution path?
2.
Any ways to "watch" such variables? Currently I am just looking at the asembly code to find what the actual execution is. For example, in source code I pass variable foo to function SetValue, but since in debugger I can not watch such variable foo, then I go to assembly code to watch what values are passed to function SetValue through register or stack.
Any better ideas to debug such x64 optimized code? Is it a common issue in debugging x64 release code?
thanks in advance,
George
|
|
|
|
|
I donot know what is a " x64 release code (optimized to full level)."
you may try this !!
Did u try to check the value in the "Immediate window" which comes when
you run your code, it will be present beside the output window, if u donot find it the go to on the top of the screen near "file, edit " options u get a Break point icon click it it will have Immediate window! click it.
Just while debugging u can just type the name of the variable in this window and press enter it gives the value of the variable !!
modified on Wednesday, September 24, 2008 8:10 AM
|
|
|
|
|
1.
No kapardhi, for some local variables, I can not see its value, the error message is "Error: expression cannot be evaluated". Any comments or ideas? This is why I come here to ask this question.
2.
"x64 release code (optimized to full level)" -- I mean build for x64 platform, open optimization to max level. Clear now?
regards,
George
|
|
|
|
|
You may be able to use the "Stakeout" debugging pattern: Get the address of the variable you want to monitor, then dereference this address in your watch window.
This is useful to monitor variables that go out of scope.
For example, enter "&foo" in the watch window to get the address of foo. Say it's 0x00112233.
Enter *(int *) 0x00112233 in the watch window. This will display the integer at this address.
|
|
|
|
|
Hi Alan!
When making my mouse over the variable, there is error message like "Error: expression cannot be evaluated", and I can not get the value of its address by using operator & in watch window, how could I know its address?
Any comments?
regards,
George
|
|
|
|
|
You might be able to get its address if you used a Debug build. Is there any reason you're trying to debug using a Release build?
|
|
|
|
|
Hi Alan,
The release version is running and serves some users, I do not want to stop it to replace with a debug version. And I can not reproduce the same issue in debug version. Just want to attach to release version running code to see some variable values.
I think debugger is using PDB file to resolve name/symbol correct? But in release version PDB has some issues and not be able to tract the correct value of variable?
regards,
George
|
|
|
|
|
1. Could you take the source code to a different machine, make a debug version, and debug it?
2. The .PDB has debugging infomation, such as variable names, as far as I know.
3. In a release version, the compiler may eliminate some variables for optimization, e.g. using a register instead of a memory location. One possibility is you could make a release version but turn off optimization. This may allow you to watch a variable.
|
|
|
|
|
Thanks Alan,
I have checked debug version debugging is fine. But if I really need to debug release version, how to monitor variable values correctly -- how to do this task efficiently? See assembly code or some other more convenient ways?
regards,
George
|
|
|
|
|
There is a compiler option to generate assembly code. If you're going to do this, the assembly code will match your source code closer if you turn off optimization.
You could also write variable values to a log file. This may be less work than using assembly code.
If your program crashes, the log file may not have the last few values written to it. You can get by this with the Lockbox debugging pattern:
For every value written, append it to the log file, then close the file. This way the file is intact even after a crash.
|
|
|
|
|
Thanks Alan,
Do you think it is a bug of PDB file which could not display the correct variable values -- my point is even if compiler is making optimization to put some variable into register other than put on the stack, PDB is not aware of this?
regards,
George
|
|
|
|
|
It could be; I don't know for sure. I think PDB files are intended to be used in debug mode, which isn't optimized.
|
|
|
|
|
Thanks Alan,
You have reproduced the same issue I mentioned?
regards,
George
|
|
|
|
|
I'm not sure what you mean. I was just giving you several suggestions that may help with your debugging.
Alan's First Rule of Debugging is: "Watch it happen."
Often the problem is not what we assume it is. Watch the bug occur either in the debugger, or by displaying variable values, possibly using the Lockbox Debugging Pattern.
Once you've seen the bug occur, then you can trace back to its cause.
|
|
|
|
|
Could you reproduce this issue I mentioned, Alan?
regards,
George
|
|
|
|
|
I want to connect a small numerical keyboard to my laptop computer. I would like to re-program the keys on the numerical keyboard, for example, when the user presses "/" I want that to be equivalent to pressing F1 on the regular keyboard. However, the regular keyboard should function as usual, that is, pressing "/" on the regular keyboard should type a "/"-character. Is this possible? If so, how do I implement it? Thanks in advance for any help.
|
|
|
|
|
If you are using an old-style "Y" splitter, I would say no.
If you are using a USB keypad, likely not, because of how the device is identified and used. At least, not without writing your own driver. It is entirely possible that the keypad was designed with USB hardware that was designed to send specific keystrokes (1-9 / * - + . ) directly to the system instead of sending generic keystrokes (key01 key02 key03 etc.) that are translated by some kind of driver to specific keystrokes.
If a serial one, it may have come with a tool to remap the keys. If not, then I believe a custom driver would be needed.
Note that writing a custom driver is not easy work, and you would need technical documentation on the specific device that you are using.
Peace!
-=- James Please rate this message - let me know if I helped or not!<hr></hr> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|