|
jhwurmbach wrote:
'BoundsChecker' or 'Purify' spring to my mind. Both are big money, but very good.
Are there any freewares around?
|
|
|
|
|
Not really.... the tools available are really for checking whether you are going past array bounds or accessing memory that hasn't been allocated. VC++ tells you when you have a memory leak and thats about as much help as your going to get anywhere.
There are a number of good articles here about how to trace your memory leaks better, look in 'Programming Tips'
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
Just being obnoxious: if I'm not mistaking the 'delete[]'-syntax is no longer needed when trying to delete an array. Following code does exactly the same thing twice:
void main() {
char* s = new char[10];
delete s;
char* p = new char[10];
delete []p;
}
|
|
|
|
|
|
I stand completely corrected. I was confused with the change from 'delete [n] array' to 'delete [] array'. And I was lucky in the example I gave, because the difference between 'delete [] array' and 'delete array' is that in the latter case no destructors are called while in the former they are. But in my example I was silly enough to use char's, who, obviously, have no destructors at all.
|
|
|
|
|
If that's window objects such like GDI handles, this article [^](and tool) may help you.
MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site.
|
|
|
|
|
this is one way to cause a memory leak.. another way is to serialize an object array which creates the objects using the word new, and does this everytime the file is loaded.. before serializing an object array you should delete everything in it before loading the objects into it again.. these are a few ways to have memory leaks.
-dz
|
|
|
|
|
Hi all,
Got a class (Y) with a CMapStringToOb member which stores my own class X.
X has appropriate DECLARE_SERIAL(X), IMPLEMENT_SERIAL(X, CObject, 1)
and Serialize (CArchive&) macros/member function. When I call Serialize
on class Y which in turn tries to Serialize the map member, I get an
access violation.
Anybody got any suggestions, been browsing the forums and other
relevant sites, not found anything as yet.
BTW, class Y also has correct DECLARE/IMPLEMENT macros.
MTIA.
Chris.
|
|
|
|
|
I think that container classes like CMap require helper functions for things like serialisation. Look it up on MSDN.
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
Found the relevant section on MSDN, having some problems implementing
the solution though. I added the code...
template <> void AFXAPI SerializeElements <CXrefEntry> (CArchive &ar, CXrefEntry *pEntries, int nCount) {<br />
for (int i = 0; i < nCount; i++, pEntries++) {<br />
pEntries->Serialize(ar);<br />
}<br />
}
... to my header file for the class stored in the map, but get a lot of errors
when I compile, saying that I'm trying to redefine SerializeElements.
I've also tried the following variation...
<br />
template <class CXrefEntry> void AFXAPI SerializeElements (CArchive &ar, CXrefEntry *pEntries, int nCount) {<br />
for (int i = 0; i < nCount; i++, pEntries++) {<br />
pEntries->Serialize(ar);<br />
}<br />
}
... which also generates errors (C2995, template function redefinition)
|
|
|
|
|
i am trying to create a folder on a local machine which is a shared folder.
i have reached to a function called NetShareAdd and it takes SHARE_ONFO_2 object as paramtere but there r problems in implementing it can anybody help me????
tahnks in advance
|
|
|
|
|
I'm sure someone could help you if you explained what your "problems in implementing it " are!
STL is a religeon. Enquiries to Reverend Christian Graus
|
|
|
|
|
Hi All,
Can any body help me on the usage of NetLocalGroupGetMembers method.A code snippet provided would be of immense help.
Thanks
Abhishek.
Learning is a never ending process of Life.
|
|
|
|
|
Hi,
In dialog-based application, how to grey or disable the toolbar button?
Thanks in advance!
chen
|
|
|
|
|
Use ON_UPDATE_COMMAND_UI handlers, you'll have to do some extra things to get them to work in dialogs but theres plenty of articles on the subject in the Dialogs section (i think).
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
Hi, I'm wondering if it's possible to take an app developed in Visual Studio .NET (Visual C++) and make an EXE out of it that can run anywhere (i.e. any Windows machine) even if it doesn't have the CLR or whatever the .NET equivalent of a JVM is? Are .NET apps always compiled into MIDL?
Bilal
|
|
|
|
|
Visual C++ in .NET can generate applications that don't require the .NET Framework.
If you write any managed code then you will need the framework.
Straight Win32/MFC/WTL apps will run fine without the framework.
Michael
Programming is great. First they pay you to introduce bugs into software. Then they pay you to remove them again.
|
|
|
|
|
You've got a tool called ngen.exe with VS.NET that is supposed to produce native code.
I haven't tested it, but it's unlikely that native code replaces the code from the framework libraries with simple non framework code.
There was a time the MS Java JDK had a jexegen.exe tool which produced true native code from any Java .class code. That's now thing of the past, unfortunately....
MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site.
|
|
|
|
|
so as long as one stays away from managed code, there shouldn't be any problems?
|
|
|
|
|
I guess Yes. Especially if you are only using Visual C++ 7 like you were using Visual C++ 6.
By the way, the "dependency walker" tool lists all static DLLs needed by your application, so it is easy to figure out if you've got anything from the .NET framework (either from the program files\.NET framework folder, or from the <windowsdir>\.NET framework folder).
MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site.
|
|
|
|
|
In abstract, I have the following code:
template <class A, bool b>
int function(A * pData, int size)
{
for(...) {
...
if (b) {
// some extra work
}
}
}
The idea is to have two versions of the templat, one with additional things to do in the inner loop.
The actual template is a bit more complex, it has four of these bools (scanning a float or double array for min, max, negative, and non-finite values)
The compiler (VC6 SP5) produces nicely optimized code - but only one version.
i.e. if I have
int a = function<float, true>(data, size);
int b = function<float, false>(data, size);
both calls go to te same <float,false> specialization.
(I haven't tried this yet with a separate project, and only with the 4 bool's mentioned above)
Any ideas?
|
|
|
|
|
Note that the C++ compiler expands templates by *type*, not *value*.
|
|
|
|
|
ok, this would break the nifty idea, but the compiler simply produces wrong code -
e.g. the call function<float,true>() going to the function<float,false>() implementation.
Auch den Schatten will ich lieben weil ich manchmal lieber frier' Rosenstolz [sighist]
|
|
|
|
|
Have anyone experience with the programming of pocketpc's
with only 256 colors? Does any mfc application are running?
I am asking that, because I want make a application and use
some GDI functions to draw some things in the view of the app
and I am using the RGB(r,g,b) marco to define the colors.
How does this work on a pocketpc with only 256 colors? Does the system convert the colors?
(I am working with eVC++ 3.0)
--
Nice greets, Daniel.
|
|
|
|
|
I've already coded something on Palm OS. Using java (j2ee) seemed the best solution. It had wrappers for your color problem
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
|
|
|
|