|
Depends on what is it doing in the constructor codes of the data type.
Primitive data type should be harmless or at least not noticeable.
If you running out of memory, it would also slow down your program because of resort to virtual memory. (It will slow or crash even for whatever you do I think anyway)
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Depends on the variable and how it is being used.
For example, creating a DWORD and adding to it in a loop is has significantly different performance implications than adding to a CString in the same loop.
I believe it boils down more to not how many variables you have, but how you are using them. Variables that manage resources for you (like CString ) are easy to use incorrectly (or at least inefficiently).
Peace!
-=- James Please rate this message - let me know if I helped or not!<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! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
This Question is a typical case of "premature optimisation".
Code your program.
If its too slow determine why. A profiler would be helpful here.
Fix *that* issue.
Failure is not an option - it's built right in.
|
|
|
|
|
Technically, yes. Would you notice it? Probably not.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi to all,
if i type the item in the edit box mean it must add into the listbox.
plz gve me ideas.
|
|
|
|
|
estherpappa wrote: if i type the item in the edit box mean it must add into the listbox.
Do you mean to say that as you are typing the text in the edit box, the changes should be reflected in the list box too?
Or you mean - that once you have finished typing the text in the edit box and do some action, then only the string should be added to the list box.
If you want this then you should have a look at CListBox::SetItemText()
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
|
If you are using MFC:
CString strText;
m_edit.GetWindowText(strText);
m_listbox.AddString(strText); If not, a Win32 example can also be provided.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Hello,
I want to use OnKeyDown() for alphabets Caps and small. But what are the codes to use since for Up and Down arrows I have used VK_DOWN and VK_UP.
I have tried VK_A to VK_Z.But that doesn't work.
Thanks
|
|
|
|
|
void COnlyForU::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if(nChar == 'a' || nChar == 'A')
else if(nChar =='b' || nChar == 'B')
CDialog::OnKeyDown(nChar, nRepCnt, nFlags);
}
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hi,
I am using Windows CE platform for my flashlite plugin application development.In the registry file(.rgs),threading model is set to Both to support both the STA and MTA.
Because of the threading model, I am getting fatal error as ,
"Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The thr eading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
So, I changed the apartment type is changed to free,apartment etc.
like ThreadingModel = Both
ThreadingModel = Free
ThreadingModel = Apartment
But I am getting the same error.It is related to _WIN32_WCE macro?
Please help me to solve this error...
Siddharth
|
|
|
|
|
Are you sure you're not doing something wrong?
I am sure single-threaded COM is supported in WinCE as this is very easy to do. COM does this by using a hidden window and a message loop to serialize the calls aka com marshalling.
Do you have the source code for the COM object, can you build it for WinCE and then try to register the com object. Possibly the existing COM object was never built to run on WinCE as some one the APIs on WinCE are light-weight and don't transfer easily from Win32 platforms.. this is what I've read as I have never developed for a WinCE platform.
You can't simpley change a COM object that was STA to MTA free threading model because then your object is not thread safe and will have all kinds of data corruption bugs! You also need to build a thread safe COM object besides the registry setting.
Also STA and MTA support has nothing to do with DCOM!
Yours Truly, The One and Only!
|
|
|
|
|
Seems a bit odd. I use COM on CE all the time and have never seen this problem but I suppose that's because all our stuff is multithreaded. If you have control over your CE platform it's possibly worth experimenting with putting DCOM back in. Our CE 5.0 has it, Microsoft just took it out by default because some things don't work. We have plenty of components with ThreadingModel='Both'
I would suggest you develop an empty or dummy COM object specifically targetted at CE, using the EVC4 compiler (which is fussier than the regular VC compilers) to make sure you can get the infrastructure working. Once you've got a working shell you can port the useful code into it. You could always create a free threaded component and simply wrap every entry point with the same critical section so that old single threaded code can be used internally without breaking anything. It's not highly efficient but it should work.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
I'd like to have a reliable method to find C style casts in the source code. They can't be easily detected like 'static_cast' and the other C++ cast operators.
If there is a tool that can do the job, please point me to it.
Thanks in advance for your help.
|
|
|
|
|
A C-style cast is generally in the form of (type)ValueToCast . If you are looking for things like that for code-review purposes, also watch out for temporaries that are created using the following syntax: type(ValueToCast) .
For example:
int iValueA = (int)dDoubleValue;
int iValueB = int( dDoubleValue );
FuncThatTakesACString( CString( "String Literal To Make A CString From" ) ); Things things should be rather easy to do a find-in-files search on, you can even automate VS using a macro to repeat the find using a list of types.
Peace!
-=- James Please rate this message - let me know if I helped or not!<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! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
That fine for intrinsic C++ type which you know exist, but how about users defined types, which you are not aware of? I think our friend wants a tool that will catch all the type cast.
Yours Truly, The One and Only!
|
|
|
|
|
Simple - you run something like Doxygen or some other documentation tool to get you all of the types that are being used by your application. You then feed that into my suggestion above.
Brute force, yes, but it works; especially when you do not what to pay money for a good code review/analysis. Hell, lint with the right rules may do it for you.
Peace!
-=- James Please rate this message - let me know if I helped or not!<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! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
sixio wrote: I'd like to have a reliable method to find C style casts in the source code.
That is near to impossible.
Thats why I usually use the C++-style casts: The stick out.
Failure is not an option - it's built right in.
|
|
|
|
|
you don't need to worry about non-class types casting like int, long, wchar_t, etc ... leave them as-is!
what you want to do is a search as someone else said of the form
(class name)
get a list of all the class names in your project and then to a find in file of that c-style casting!
i.e class MyClass {...};
search for "(MyClass)" in the entire solution!
Yours Truly, The One and Only!
|
|
|
|
|
Hi all,
I am facing problem in creating a file and writing to it.
The code looks like this:
TCHAR path[50];
fpLog = fopen((LPCSTR)path,"wt+");
When i am storing some predefined path in variable path.In this case the file is not created in the directory when fopen is executed but when i directly give path e.g D:\\file.txt the file is created and written also.
May be i am wrong in executing fopen.
Regards,
|
|
|
|
|
try _tfopen without casting a TCHAR to a char
|
|
|
|
|
Maynka wrote: When i am storing some predefined path in variable path.In this case the file is not created in the directory when fopen is executed but when i directly give path e.g D:\\file.txt the file is created and written also.
Are you confusing an absolute path with a relative path?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I've draw a spline in a view whose DC is in Himetric mode using GDI+.No problem is here. But when I print this same spline, it is not placed at proper location. I've observed that all points that are use for spline drawing, remain same and DC also is in HIMETRIC mode. What I have to do to solve the problem? Do I need to change the pointlist that construct the spline for printing? If so how can I do that?
|
|
|
|
|
Assuming you have the normal printing gotchas out of the way that are typical in GDI based applications, you need to ensure the GDI+ environment does not interfere with the GDI mapping routines if you are using those instead of the GDI+ transformations.
Jonathan de Halleux has some good tips about this general topic...
Tips on printing with GDI+[^]
Specifically, set
graphics.SetPageUnit(UnitPixel);
to prevent GDI+ interference in the mapping mode stuff.
Hope this helps
|
|
|
|