|
Just i thought if there'll be a large class full of functions (all database part take place in this func) may use a lot memory, so i thought that may be it is better to call them staticly so there wont be an object in memory everytime.
|
|
|
|
|
If the function itself is not written well and it abuses memory, it is going to do so regardless of being a normal class member or a static member.
If you end up having static data members used by the functions, make sure you protect them against concurrent access if you have multiple threads running.
Peace!
-=- James 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! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
I guess its better using classic functions.
|
|
|
|
|
Why is it better to use classic functions? If you don't need "this", don't use it. Make the functions static, that is what they are. If they need to call non-static methods, then your class isn't well defined. If you have static variables in these static methods, then your class isn't well defined.
If you don't need "this", make the routine static. If you do need "this", make it a thiscall. Use the right thing in the right place.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
"Better" is a subjective term. Static and non-static methods each have their place. It all depends on the nature of the problem.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Look into the Singleton design pattern and see if that will work for you.
|
|
|
|
|
Hello,
i´m trying to create a program that creates several independent windows with CreateWindow, each one will handle it´s own events, and will run completely independent, and i don´t know how to create all the windows, i tried with several CreateWindow in the WinMain, but the second window is created only if the first is closed, and the same with rest.
How can i do this, creating several threads or there is a way to create a window with the event loop, but return the control to the main application?
|
|
|
|
|
Why not create a number of CWinThread objects, and let each one run its own window message pump - just make sure that the primary thread (that creates the others) sticks around until the other threads terminate.
|
|
|
|
|
Hi,
I need help on passing arrays from VB to VC++ function through a macro written in VC++. I want to pass an empty array by reference from VB to a VC++ function and modify the ubound of the passed array in the VC++ program. Can I redimension the empty array within VC++. Can I get back multidimensional arrays.
Thanks in advance.
Viswanathan Jayaraman
|
|
|
|
|
pls help me in my trouble.i want to convert double value to ascii.can u give code for that?if it is not possible how can i do it?
shan
|
|
|
|
|
<font color=blue>double</font> d = 5.4E3;
<font color=blue>char</font> str[50];
sprintf(str, <font color=gray>"%f"</font>, d);
cheers,
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
MFC:
double dblValue = sqrt(2);
CString csText;
csText.Format("%f",dblValue);
C:
char Buffer[256];
double dblValue = sqrt(2);
sprintf(Buffer,"%f",dblValue);
|
|
|
|
|
%g or %f in sprintf:
%f => double Signed value having the form [ – ]dddd.dddd, where dddd is one or more decimal digits. The number of digits before the decimal point depends on the magnitude of the number, and the number of digits after the decimal point depends on the requested precision.
%g => double Signed value printed in f or e format, whichever is more compact for the given value and precision. The e format is used only when the exponent of the value is less than –4 or greater than or equal to the precision argument. Trailing zeros are truncated, and the decimal point appears only if one or more digits follow it.
Extract from MSDN doc.
...
|
|
|
|
|
shaans wrote:
i want to convert double value to ascii.
This makes no sense. With the exception of Unicode, all of the characters, numbers, and symbols you can type are ASCII. There is no such thing as converting from any of those to ASCII. Please explain further what it is that you are attempting to do.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
CString sr=m_edit6.Left(3);
//ch=sr.GetAt(0);
char *t;
double dt=::strtod(sr,&t);
CString str1;
str1.Format("%g",dt);
MessageBox(str1);
this str1 contains a double value.i want to convert this double value into its ASCII value.plz help mw with this.
|
|
|
|
|
Why the extra step?
sr --> dt --> str1
How about:
str1.Format("%g", (LPCSTR) m_edit6.Left(3)); If you need the intermediate step, why not use atof() instead of strtod() ?
Anonymous wrote:
this str1 contains a double value.i want to convert this double value into its ASCII value.
Let me see if I have this right. If str1 contains the value 123.45, what exactly is it that you want it converted to? The ASCII value of 1 is 49, 2 is 50, etc. The ASCII value of the decimal is 46. How are you wanting to store these values?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi everybody,
I'm going to write a multichannel audio application with directX under VC++ 6. I know that for using multichannel I have to use the WAVEFORMATEXTENSIBLE structure instead of WAVEFORMATEX. This structure is supposed to be declared in mmreg.h, unfortunately not in my version of this header file. I have VC servicepack 6 and dx90bsdk installed on my computer.
Do I make a silly mistake or does anybody else encountered this problem? Can anybody tell me where I can get the correct mmreg.h?
Thanks for your help,
Frank.
|
|
|
|
|
Hi
You can find it ksMedia.h header file
Cheers
|
|
|
|
|
Thanx,
I've tried it with these headers and it worked perfectly.
|
|
|
|
|
Thanx,
I've tried it and it worked perfectly.
|
|
|
|
|
I want to search word file(.doc) according the key word in the word file's content(not title^_^).who can tell me what i should do??thanks!!!
Jack
|
|
|
|
|
Start by looking at Chris Losinger's filefinder class. Do a search on it.
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Thanks, but where can I find the class???
Jack
|
|
|
|
|
|
Hi guys !
I'm trying to make an activeX quite simple wich upload and download file from an url.
I successfully did it but i still have a trouble. I'd like to access to my activeX in javascript with the
var oActiveX= new ActiveXObject("testX")
command. This command is working, i thinck, because i haven't got errors, but when i'm trying to access to an ActiveX method,
oActiveX.view();
there is an error, i can't acess to the method
However, if i'm trying to access to my activeX with the html method :
<OBJECT ID="TestX"<br />
CLASSID="CLSID:75CE4352-E461-4031-B662-4FF071C3A963"<br />
CODEBASE="TestX.ocx"></OBJECT><br />
<SCRIPT LANGUAGE="JavaScript"><br />
<!-- TestX.view(); -->
Can somedoby tell me why those damned method are not accessible with the first method but aren't with the second ?
Thanks in advance
|
|
|
|