Thread: Assigning int32_t to std::string, should this be allowed?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    It's a narrowing conversion. Unfortunately, GCC doesn't warn about that (though Visual C++ does).
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  2. #2
    Registered User
    Join Date
    May 2011
    Posts
    2
    Thanks for the responses, I guess it makes sense if int32_t is being converted to char and char assignment to std::string is allowed. I wish gcc would at least warn about that conversion as Elysia reports Visual C++ does. Who knew MS would be more user friendly?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. assigning a string
    By steve1_rm in forum C Programming
    Replies: 5
    Last Post: 04-14-2008, 02:40 AM
  2. Replies: 8
    Last Post: 10-21-2007, 01:38 PM
  3. assigning a string to a variable
    By xp5 in forum C Programming
    Replies: 12
    Last Post: 08-30-2007, 01:13 AM
  4. Assigning string to values
    By Itanium in forum C++ Programming
    Replies: 3
    Last Post: 09-24-2003, 07:28 AM
  5. assigning string problem
    By sjfx in forum C++ Programming
    Replies: 2
    Last Post: 11-06-2002, 06:18 PM