|
Thank you. Do you know how to implement a DLL of my own that will work this way?
thanks!
|
|
|
|
|
|
I just read John Simmons post about getting his app to compile cleaning at warning level 4.
So, just for kicks I thought I'd try it on a console server app I am currently finishing up. But I get oodles and oodles of warnings from within the STL headers. Is there some other setting you need to use to do this? Is it not possible to have w4 clean code and use STL? This is using VC6 (sp5).
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
Just as an aside, I've noticed that there is reference to the /Za option, to disable Microsoft language extensions. But if you do this, then you lose the __declspec(__import), and __declspec(__export). Which means, if you do C++, that if you are creating a DLL, you'll need to export the functions by hand through a .def file, right? Isn't that a total nightmare? Does anyone actually do this?
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
Jim Crafton wrote: Isn't that a total nightmare? Does anyone actually do this?
it's not really a nightmare. you just put the function names in the .DEF file and compile... i do it all the time.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Right but with a C++ DLL (i.e. exporting a C++ class from the DLL), you can't do that - you have to put the name mangled names right? Plus, at least for my project at home, this could amount to several hundred classes (at least).
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
Jim Crafton wrote: Right but with a C++ DLL (i.e. exporting a C++ class from the DLL), you can't do that - you have to put the name mangled names right? Plus, at least for my project at home, this could amount to several hundred classes (at least).
There is a free tool that would automatically export all mangled names into a def file, but I can't remember its name
Anyway, even that is not perfect - you don't want all functions from all classes exported.
[EDIT] I remember now. It is dlltool[^].
[/EDIT]
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
-- modified at 21:25 Tuesday 1st November, 2005
|
|
|
|
|
|
OK but doesn't that defeat the whole purpose? For example I already do this for warning 4786. Is there a standard list of warnings you can safely ignore for warning level 4?
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
I have always been lead to believe that the STL shipped with VC6 is an absolute dog and should be avoided. Whether there is much truth in that or not is up to a decent Google search I do notice that Scott Meyers excellent Effective STL book contains a whole appendix on working around limitations in the VC6 STL.
I use a lot of STL with VS2003 and always compile at warning level 4. I get one warning for release builds when including, amongst a few others, <vector> (some debug code that is unreachable in release mode). Consequently I have something like this:
#pragma warning(push)
#pragma warning(disable: 4702)
#include <vector>
#pragma warning(pop)
I tend to include a special stdstl.h file in my pre-compiled header, containing all the STL headers my project needs (including some boost headers) so I only need this hack in one place.
I haven't tried a build in VS2005 yet, so maybe this C4702 warning has been dealt with.
The Rob Blog Google Talk: robert.caldecott
|
|
|
|
|
Hmm, that's a good point! I'd forgotten about pragma push/pop!
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
Hmm, well I just created a new console project (in vc6) and changed it's setting to Multi Threaded CRT, on warning level 4.
here's the main:
#include "stdafx.h"
#pragma warning (push)
#pragma warning (disable : 4100)
#pragma warning (disable : 4663)
#pragma warning (disable : 4511)
#pragma warning (disable : 4512)
#pragma warning (disable : 4018)
#pragma warning (disable : 4244)
#include <vector>
#pragma warning (pop)
int main(int , char** )
{
return 0;
}
And this just creates loads of warnings, in fact the very same ones I have turned off!
So now I try turning off the language extensions.
Voila! All the warnings are gone, but now I get 102 errors like:
c:\program files\microsoft visual studio\vc98\include\utility(81) : error C2146: syntax error : missing ';' before identifier 'iterator_category'
Sigh, oh well, it's just not worth fighting with
I can't see how anyone who uses STL, VC6, and creates DLLs that export C++ classes can compile at warning level 4.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
-- modified at 16:29 Tuesday 1st November, 2005
|
|
|
|
|
Robert Edward Caldecott wrote: I haven't tried a build in VS2005 yet, so maybe this C4702 warning has been dealt with.
Apparently, yes[^].
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
Jim Crafton wrote: Is it not possible to have w4 clean code and use STL? This is using VC6 (sp5).
Allegedly installing and changing VS to the windows 2003 SDK is suppose to fix those problems. I installed it and just haven’t gotten around to setting VS to use the new headers.
DEBUGGING : Removing the needles from the haystack.
|
|
|
|
|
I'm looking to access file information such as the Author and comments and such. FileInfo does not expose these properties. It was suggested in the C# forum to post the question here as I may need to make a win32 api call. Any suggestions?
|
|
|
|
|
|
Usefull the information was but it was not what I was looking for.
This information can be set by right click, properties, summary tab. Where is this infomration stored and how does one retreive the information?
|
|
|
|
|
Hi Kaptain Krunch,
Please list file extensions.
Thanks,
Jeff
|
|
|
|
|
They can be TXT, PDF, DOC, BAT and so on. I don't think that its related to the file extension as any file I check has the properties/summary tab. This is on XP anyway.
|
|
|
|
|
|
Hi,
I have stored some data into vector
<br />
std::vector<Item *> m_cache;<br />
std::vector<Item *>::iterator m_iterator ;<br />
Can you please let me know how to clean this vector.Currently i am doing m_cache.clear();however it is not deleting the memory allocated for the Item * element.
Thanks
-- modified at 12:29 Tuesday 1st November, 2005
|
|
|
|
|
you need to iterate the vector to delete each item.
std::vector<Item *>::iterator m_iterator = m_cache.begin();
while ( m_iterator = m_cache.end() )
{
Item* p = *it;
delete p;
++it;
}
but some STL guru might give you an single line algorithm to do this.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
std::vector<>::clear() just set the vector empty.
you would have to iterate on each element of you container to delete it first, the call clear()
for example :
std::vector<Item*> m_cache;
std::vector<Item*>::iterator m_iterator;
for (m_iterator = m_cache.begin(); m_iterator != m_cache.end(); m_iterator++) {
delete (*m_iterator);
}
m_cache.clear();
another solution, much object oriented however, would be to create you how vector-derived type, and overload the clear() function with the code above...
TOXCCT >>> GEII power [toxcct][VisualCalc]
-- modified at 12:37 Tuesday 1st November, 2005
|
|
|
|
|
well thank you for your help however i think it should be
<br />
for (CACHE_ITERATOR it = m_cache.begin();it != m_cache.end();it++)<br />
{<br />
delete ((Item *)*it);<br />
}<br />
m_cache.clear();<br />
|
|
|
|
|