Re: [Boost-bugs] [Boost C++ Libraries] #4790: Suggest improvement to mpl::string documentation

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4790: Suggest improvement to mpl::string documentation
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-10-26 03:34:05


#4790: Suggest improvement to mpl::string documentation
----------------------------------------------+-----------------------------
  Reporter: Joshua Hale <jgh.emc@…> | Owner: agurtovoy
      Type: Tasks | Status: new
 Milestone: To Be Determined | Component: mpl
   Version: Boost 1.40.0 | Severity: Cosmetic
Resolution: | Keywords: string
----------------------------------------------+-----------------------------

Comment (by Joshua Hale <jgh.emc@…>):

 I suggest adding a warning to the documentation for mpl::string regarding
 multi-byte character types.

 Specifically, I was unable to compile the example:

     typedef mpl::string<'hell','o wo','rld'> hello;

     typedef mpl::push_back<hello, mpl::char_<'!'> >::type hello2;

     BOOST_ASSERT(0 == std::strcmp(mpl::c_str<hello2>::value, "hello
 world!"));

 Using g++ 4.4.3 I got:

     error: multi-character character constant

 Comprehending the problem involved investigating/learning the following
 points:

     what is a multi-character literal

     the warning in g++ can be disabled with -Wno-multichar
       (I always use -Werror, hence all warnings generate errors)

     the maximum length of a multi-character literal on my system is 4
 characters

 The latter two points are OS specific and therefore don't seem appropriate
 for the mpl::string documentation, and the first point may I guess be
 regarded as expected prior knowledge (though a one sentence summary would
 save a lot of time since they appear to be not so widely known).

 But I do recommend adding a caveat beside the example code regarding
 possible problems compiling multi-character literals, and the alternative
 equivalent example with the characters independently ('h','e','l', ...).

 I also recommend including a warning regarding their implementation-
 dependent nature (based on what the g++ manual has to say; copied below)
 since they appear likely to propagate portability problems.

     -Wno-multichar

         Do not warn if a multicharacter constant ('FOOF') is used. Usually
 they indicate a typo in the user's code, as they have implementation-
 defined values, and should not be used in portable code.

 I hope this comment is useful. I am repeatedly awed by the cunning majesty
 of all the boost libraries I have explored and the MPL may be, for me, at
 the peak in that respect.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4790#comment:1>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:04 UTC