.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > General Programming
General Programming Help others and get yourself helped here!

Reply
 
Thread Tools
c++ noob stuff
Old
  (#1)
commonbullet
Member
 
commonbullet's Avatar
 
Status: Offline
Posts: 49
Join Date: Nov 2004
Default c++ noob stuff - 04-11-2006

hi,
check this example:
PHP Code:
#include <map>
#include <string>
#include <stdio.h>

using namespace std;

int main() {
    
map <stringstringtest;
    
test["anykey"] = "anyvalue";
    
printf("anykey -> %s"test["anykey"].c_str());
    return 
0;

It complies ok in msvc++ 6.0 and it also seems to work. But I get so much warnings (about 107), I'm afraid police is coming to arrest me or something.
Any ideas?

thanks.

Last edited by commonbullet; 04-11-2006 at 21:28..
  
Reply With Quote
Re: c++ noob stuff
Old
  (#2)
@$3.1415rin
Council Member, Author of JoeBOT
 
@$3.1415rin's Avatar
 
Status: Offline
Posts: 1,381
Join Date: Nov 2003
Location: Germany
Default Re: c++ noob stuff - 04-11-2006

post removed, stupid idea, it was too late



Last edited by @$3.1415rin; 05-11-2006 at 12:13..
  
Reply With Quote
Re: c++ noob stuff
Old
  (#3)
commonbullet
Member
 
commonbullet's Avatar
 
Status: Offline
Posts: 49
Join Date: Nov 2004
Default Re: c++ noob stuff - 05-11-2006

Quote:
Originally Posted by @$3.1415rin View Post
if you want to have the value of a character, you have to use 'a' instead of "A". the latter would give you a pointer to a char array containing an 'A' and a '\0'
Sorry, I didn't get it. I don't mean to get a char value..., I'm pretty stupid with this.

Anyway I found this:
Quote:
When using the STL with MSVC, you may get one or more error messages that look like:

C:\MSOE\stltest\stl2\stl2.cpp(302) : warning C4786: 'std::pair<std::_Tree <int,int, std::set<int,std::less<int>, std::allocator<int>>::_Kfn, std::less<int>, std::allocator<int>>::const_iterator, std::_Tree<int,int, std::set<int,std::less<int>, std::allocator<int>>::_Kfn, std::less<int>, std::allocator<int>>::const_iterator>' : identifier was truncated to '255' characters in the debug information

This message results when MSVC tries to store debug information that includes long names generated by the template expansion process. The problem normally has no significant effect, and the message can be ignored. You may prefer to suppress this warning completely, as it may hide other (more important) error messages. To suppress the warning, add the following line near the top of your program source file:
#pragma warning(disable:4786)
out there:
http://www.msoe.edu/eecs/cese/resour...space%20issues

So, maybe it's an old implementation of stl on msvc. I've compiled a similar code with a newer msvc++ (express version) with no warnings. dev-c++ also compiles it with no problems...
  
Reply With Quote
Re: c++ noob stuff
Old
  (#4)
mirv
Super Moderator
 
mirv's Avatar
 
Status: Offline
Posts: 152
Join Date: Apr 2004
Default Re: c++ noob stuff - 05-11-2006

Looks to me like msvc++6.0 was trying to keep debug file sizes from getting too large. So wouldn't worry about it. dev-c++ uses the mingw library if I'm not mistaken, and express ed of msvc++ is based on msvc++8 I think.
It's not surprising really that a hash table of strings, using a string as the key, would generate some rather large template names either, and memory use is probably right up there with it (map implementation pending). Is there any other key you could use other than string?


mirv the Silly Fish.
  
Reply With Quote
Re: c++ noob stuff
Old
  (#5)
commonbullet
Member
 
commonbullet's Avatar
 
Status: Offline
Posts: 49
Join Date: Nov 2004
Default Re: c++ noob stuff - 05-11-2006

all right,

If I can use a delimited char array it would be ok.

I'd tried map<char*, char*> and had the same warnings...

thanks.

EDIT: I guess it won't work with something like <char[32], char[32]>, though.
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com