|
|
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 />
|
|
|
|
|
|
I need some help. I’m working on a project with some schools that involve Windows and “hosts” file work. The network I’m working on requires several pre defined domains that need to be assigned to a different IP address which is achieved through using the hosts file.
The problem that I’m running into is that a hosts file over 150K will start to crash the Dnscache service under Windows 2000 and XP. I have to disable this service in order to have everything work. The problem with doing this is that resolving a host without Dnscache has considerable latency issues and an overall slow connection time without the Dnscache service running. It doesn’t matter if the hosts file is 1K or 300K, without DNS caching, it is very slow.
I would very much appreciate it if someone could assist me or even just write a small C or C++ win32 console app that can be run and installed as a service through the command line using the “sc config” and “net start” commands. It would need to be able to replace the Dnscache “dnsrslvr.dll” service. This service is nice but not very robust when it comes to actually using the hosts file for what it was designed for.
Really, it doesn’t have to load the whole hosts file into memory like the Dnscache “dnsrslvr.dll” service does. All this program would need to do is pre allocate a small chunk of memory and then just monitor domain name requests. When the IP address is returned from the DNS server out on the web or from the hosts file, it would just need to cache it into memory. The initial connection would still be the time required to ask the DNS server or hosts file for the IP address but after that, the site would load faster because all of the graphics, applets and so on would already be pointing to the IP address.
I would even be willing to compensate a bit for the time spent doing this. I know time is valuable. Please contact me at jamie@unitedcomputerservice.com
I will also keep checking the post here. Thank you in advance for anyone who could help me in this effort. I write code but this one is a bit out of my area to be comfortable. Is there any way that someone could help?
|
|
|
|
|
Hello,
I found this program online. I think it might be written in C.
Can someone convert this to Visual C++ for me?
I would like to show my wife that she cannot visualize what a googolplex is.
Thanks,
Eric
<br />
#include <stdio.h><br />
#include <stdlib.h><br />
<br />
int main (int argc, char *argv[])<br />
{<br />
int *vals, *ptr, max;<br />
<br />
if (argc == 2)<br />
max = atoi (argv[1]);<br />
else<br />
max = 100;<br />
<br />
printf ("1");<br />
<br />
if ((vals = malloc ((max + 1) * sizeof (int))) == NULL) {<br />
fprintf (stderr, "Error allocating memory.\n");<br />
return 1;<br />
}<br />
<br />
memset (vals, '\0', (max + 1) * sizeof (int));<br />
<br />
while (!vals[max]) {<br />
*(ptr = vals) += 1;<br />
<br />
while (*ptr == 10) {<br />
*ptr++ = 0;<br />
*ptr += 1;<br />
}<br />
<br />
printf ("0");<br />
}<br />
printf ("\n");<br />
free (vals);<br />
return 0;<br />
}<br />
<br />
|
|
|
|
|
AFAIK, it's impossible to represent a googolplex, it should be bigger than the largest number you can think of ...
much bigger than 100 digits in a number.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
ericelysia wrote: Can someone convert this to Visual C++ for me?
Why? What significance would objects, encapsulation, inheritance, abstraction, or polymorphism have on this? Why not just write 1010100 on a piece of paper and show that to her?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
I just want her to see all of the zeros going and going and going.
Is that what that C code is doing (100 ^ 10 ^ 100) ?
If so, why does it look more complex?
Thanks,
Eric
|
|
|
|
|
ericelysia wrote: I just want her to see all of the zeros going and going and going.
printf(" 100\n");
printf(" 10\n");
printf("100 = 1");
int i = 0;
int j = 0;
for (i = 0; i < 100; i++) {
for (j = 0; j < 100; j++) {
printf("0");
}
}
this will print the following :
100
10
100 = 1000000000000...
TOXCCT >>> GEII power [toxcct][VisualCalc]
-- modified at 12:39 Tuesday 1st November, 2005
|
|
|
|
|
ericelysia wrote: Is that what that C code is doing (100 ^ 10 ^ 100) ?
I did not look at the code that close, but a googleplex is 10 raised to the power of a google, or 10 ^ (10 ^ 100).
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|