Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78521 - in trunk/libs/conversion: doc perf test
From: antoshkka_at_[hidden]
Date: 2012-05-20 12:25:24


Author: apolukhin
Date: 2012-05-20 12:25:21 EDT (Sun, 20 May 2012)
New Revision: 78521
URL: http://svn.boost.org/trac/boost/changeset/78521

Log:
Do not force PGI compiler to use fallback version of lexical_cast (PGI fails tests even in fallback version)
Trialing whitespaces removed
Text files modified:
   trunk/libs/conversion/doc/Jamfile.v2 | 6 +-
   trunk/libs/conversion/doc/lexical_cast.qbk | 62 ++++++++++++++++++++--------------------
   trunk/libs/conversion/perf/Jamfile.v2 | 10 +++---
   trunk/libs/conversion/test/Jamfile.v2 | 10 +++---
   trunk/libs/conversion/test/implicit_cast.cpp | 2
   trunk/libs/conversion/test/lexical_cast_containers_test.cpp | 2
   trunk/libs/conversion/test/lexical_cast_float_types_test.cpp | 2
   trunk/libs/conversion/test/lexical_cast_iterator_range_test.cpp | 12 +++---
   trunk/libs/conversion/test/lexical_cast_no_exceptions_test.cpp | 14 ++++----
   trunk/libs/conversion/test/lexical_cast_no_locale_test.cpp | 10 +++---
   trunk/libs/conversion/test/lexical_cast_typedefed_wchar_test_runtime.cpp | 2
   11 files changed, 66 insertions(+), 66 deletions(-)

Modified: trunk/libs/conversion/doc/Jamfile.v2
==============================================================================
--- trunk/libs/conversion/doc/Jamfile.v2 (original)
+++ trunk/libs/conversion/doc/Jamfile.v2 2012-05-20 12:25:21 EDT (Sun, 20 May 2012)
@@ -6,9 +6,9 @@
 import boostbook : boostbook ;
 
 xml lexical_cast : lexical_cast.qbk ;
-boostbook standalone
- :
- lexical_cast
+boostbook standalone
+ :
+ lexical_cast
     :
         <xsl:param>boost.root=../../../..
         <format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/doc/html

Modified: trunk/libs/conversion/doc/lexical_cast.qbk
==============================================================================
--- trunk/libs/conversion/doc/lexical_cast.qbk (original)
+++ trunk/libs/conversion/doc/lexical_cast.qbk 2012-05-20 12:25:21 EDT (Sun, 20 May 2012)
@@ -34,7 +34,7 @@
 
 The `lexical_cast` function template offers a convenient and consistent form for supporting common conversions to and from arbitrary types when they are represented as text. The simplification it offers is in expression-level convenience for such conversions. For more involved conversions, such as where precision or formatting need tighter control than is offered by the default behavior of `lexical_cast`, the conventional `std::stringstream` approach is recommended. Where the conversions are numeric to numeric, __numericcast__ may offer more reasonable behavior than `lexical_cast`.
 
-For a good discussion of the options and issues involved in string-based formatting, including comparison of `stringstream`, `lexical_cast`, and others, see Herb Sutter's article, [@http://www.gotw.ca/publications/mill19.htm The String Formatters of Manor Farm]. Also, take a look at the [link boost_lexical_cast.performance Performance] section.
+For a good discussion of the options and issues involved in string-based formatting, including comparison of `stringstream`, `lexical_cast`, and others, see Herb Sutter's article, [@http://www.gotw.ca/publications/mill19.htm The String Formatters of Manor Farm]. Also, take a look at the [link boost_lexical_cast.performance Performance] section.
 [endsect]
 
 [section Examples]
@@ -105,8 +105,8 @@
 * `boost::iterator_range<WideCharPtr>`, where `WideCharPtr` is a pointer to wide-character or pointer to const wide-character
 
 [important Many compilers and runtime libraries fail to make conversions using new Unicode characters. Make shure that the following code compiles and outputs nonzero values, before using new types:
-``
- std::cout
+``
+ std::cout
         << booat::lexical_cast<std::u32string>(1.0).size()
         << " "
         << booat::lexical_cast<std::u16string>(1.0).size();
@@ -151,13 +151,13 @@
             return data_length;
         }
     };
-
+
     inline std::ostream& operator << (std::ostream& ostr, const example_class& rhs) {
         return ostr << boost::make_iterator_range(rhs.data(), rhs.data() + rhs.size());
     }
 ``
 
-This is a good generic solution for most use cases.
+This is a good generic solution for most use cases.
 But we can make it even faster for some performance critical applications. During conversion, we loose speed at:
 
  * `std::ostream` construction (it makes some heap allocations)
@@ -182,35 +182,35 @@
 [section Frequently Asked Questions]
 
 * [*Question:] Why does `lexical_cast<int8_t>("127")` throw `bad_lexical_cast`?
- * [*Answer:] The type `int8_t` is a `typedef` to `char` or `signed char`. Lexical conversion to these types is simply reading a byte from source but since the source has more than one byte, the exception is thrown.
-Please use other integer types such as `int` or `short int`. If bounds checking is important, you can also
-call __numericcast__:
+ * [*Answer:] The type `int8_t` is a `typedef` to `char` or `signed char`. Lexical conversion to these types is simply reading a byte from source but since the source has more than one byte, the exception is thrown.
+Please use other integer types such as `int` or `short int`. If bounds checking is important, you can also
+call __numericcast__:
 `numeric_cast<int8_t>(lexical_cast<int>("127"));`
 
 [pre
 ]
 
 * [*Question:] Why does `lexical_cast<unsigned char>("127")` throw `bad_lexical_cast`?
- * [*Answer:] Lexical conversion to any char type is simply reading a byte from source. But since the source has more than one byte, the exception is thrown.
-Please use other integer types such as `int` or `short int`. If bounds checking is important, you can also
-call __numericcast__:
+ * [*Answer:] Lexical conversion to any char type is simply reading a byte from source. But since the source has more than one byte, the exception is thrown.
+Please use other integer types such as `int` or `short int`. If bounds checking is important, you can also
+call __numericcast__:
 `numeric_cast<unsigned char>(lexical_cast<int>("127"));`
 
 [pre
 ]
 
 * [*Question:] What does `lexical_cast<std::string>` of an `int8_t` or `uint8_t` not do what I expect?
- * [*Answer:] As above, note that int8_t and uint8_t are actually chars and are formatted as such. To avoid
+ * [*Answer:] As above, note that int8_t and uint8_t are actually chars and are formatted as such. To avoid
 this, cast to an integer type first: `lexical_cast<std::string>(static_cast<int>(n));`
 
 [pre
 ]
 
-* [*Question:] The implementation always resets the `ios_base::skipws` flag of an underlying stream object.
+* [*Question:] The implementation always resets the `ios_base::skipws` flag of an underlying stream object.
 It breaks my `operator>>` that works only in presence of this flag. Can you remove code that resets the flag?
- * [*Answer:] May be in a future version. There is no requirement in
-__proposallong__ to reset the flag but
-remember that __proposalshort__ is not yet accepted by the committee. By the way, it's a great opportunity to
+ * [*Answer:] May be in a future version. There is no requirement in
+__proposallong__ to reset the flag but
+remember that __proposalshort__ is not yet accepted by the committee. By the way, it's a great opportunity to
 make your `operator>>` conform to the standard.
 Read a good C++ book, study `std::sentry` and [@boost:libs/io/doc/ios_state.html `ios_state_saver`].
 
@@ -218,17 +218,17 @@
 ]
 
 * [*Question:] Why `std::cout << boost::lexical_cast<unsigned int>("-1");` does not throw, but outputs 4294967295?
- * [*Answer:] `boost::lexical_cast` has the behavior of `std::stringstream`, which uses `num_get` functions of
-`std::locale` to convert numbers. If we look at the Programming languages — C++, we'll see, that `num_get` uses
-the rules of `scanf` for conversions. And in the C99 standard for unsigned input value minus sign is optional, so
+ * [*Answer:] `boost::lexical_cast` has the behavior of `std::stringstream`, which uses `num_get` functions of
+`std::locale` to convert numbers. If we look at the Programming languages — C++, we'll see, that `num_get` uses
+the rules of `scanf` for conversions. And in the C99 standard for unsigned input value minus sign is optional, so
 if a negative number is read, no errors will arise and the result will be the two's complement.
 
 [pre
 ]
 
 * [*Question:] Why `boost::lexical_cast<int>(L'A');` outputs 65 and `boost::lexical_cast<wchar_t>(L"65");` does not throw?
- * [*Answer:] If you are using an old version of Visual Studio or compile code with /Zc:wchar_t- flag,
-`boost::lexical_cast` sees single `wchar_t` character as `unsigned short`. It is not a `boost::lexical_cast` mistake, but a
+ * [*Answer:] If you are using an old version of Visual Studio or compile code with /Zc:wchar_t- flag,
+`boost::lexical_cast` sees single `wchar_t` character as `unsigned short`. It is not a `boost::lexical_cast` mistake, but a
 limitation of compiler options that you use.
 
 [pre
@@ -236,7 +236,7 @@
 
 * [*Question:] Why `boost::lexical_cast<double>("-1.#IND");` throws `boost::bad_lexical_cast`?
   * [*Answer:] `"-1.#IND"` is a compiler extension, that violates standard. You shall input `"-nan"`, `"nan"`, `"inf"`
-, `"-inf"` (case insensitive) strings to get NaN and Inf values. `boost::lexical_cast<string>` outputs `"-nan"`, `"nan"`,
+, `"-inf"` (case insensitive) strings to get NaN and Inf values. `boost::lexical_cast<string>` outputs `"-nan"`, `"nan"`,
 `"inf"`, `"-inf"` strings, when has NaN or Inf input values.
 
 * [*Question:] What is the fastest way to convert a non zero terminated string or a substring using `boost::lexical_cast`?
@@ -246,21 +246,21 @@
 
 [section Changes]
 * [*boost 1.50.0 :]
-
+
     * `boost::bad_lexical_cast` exception is now globaly visible and can be catched even if code is compiled with -fvisibility=hidden.
     * Now it is possible to compile library with disabled exceptions.
     * Better performance, less memory usage and bugfixes for `boost::iterator_range<character_type*>` conversions.
 
 * [*boost 1.49.0 :]
-
- * Restored work with typedefed wchar_t (compilation flag /Zc:wchar_t- for Visual Studio).
+
+ * Restored work with typedefed wchar_t (compilation flag /Zc:wchar_t- for Visual Studio).
     * Better performance and less memory usage for `boost::container::basic_string` conversions.
-
+
 * [*boost 1.48.0 :]
-
- * Added code to work with Inf and NaN on any platform.
+
+ * Added code to work with Inf and NaN on any platform.
     * Better performance and less memory usage for conversions to float type (and to double type, if `sizeof(double) < sizeof(long double)`).
-
+
 * [*boost 1.47.0 :]
 
     * Optimizations for "C" and other locales without number grouping.
@@ -283,7 +283,7 @@
     * The previous version of lexical_cast used the default stream precision for reading and writing floating-point numbers. For numerics that have a corresponding specialization of `std::numeric_limits`, the current version now chooses a precision to match.
     * The previous version of lexical_cast did not support conversion to or from any wide-character-based types. For compilers with full language and library support for wide characters, `lexical_cast` now supports conversions from `wchar_t`, `wchar_t *`, and `std::wstring` and to `wchar_t` and `std::wstring`.
     * The previous version of `lexical_cast` assumed that the conventional stream extractor operators were sufficient for reading values. However, string I/O is asymmetric, with the result that spaces play the role of I/O separators rather than string content. The current version fixes this error for `std::string` and, where supported, `std::wstring`: `lexical_cast<std::string>("Hello, World")` succeeds instead of failing with a `bad_lexical_cast` exception.
- * The previous version of `lexical_cast` allowed unsafe and meaningless conversions to pointers. The current version now throws a `bad_lexical_cast` for conversions to pointers: `lexical_cast<char *>("Goodbye, World")` now throws an exception instead of causing undefined behavior.
+ * The previous version of `lexical_cast` allowed unsafe and meaningless conversions to pointers. The current version now throws a `bad_lexical_cast` for conversions to pointers: `lexical_cast<char *>("Goodbye, World")` now throws an exception instead of causing undefined behavior.
 
 [endsect]
 
@@ -328,7 +328,7 @@
   ``]
   ]
 ]
-Fastest results are highlitened with "!!! *x* !!!".
+Fastest results are highlitened with "!!! *x* !!!".
 Do not use this results to compare compilers, because tests were taken on different hardware.
 
 [endsect]

Modified: trunk/libs/conversion/perf/Jamfile.v2
==============================================================================
--- trunk/libs/conversion/perf/Jamfile.v2 (original)
+++ trunk/libs/conversion/perf/Jamfile.v2 2012-05-20 12:25:21 EDT (Sun, 20 May 2012)
@@ -13,17 +13,17 @@
 
 project performance/test
     : source-location ./
- : requirements
-# <library>/boost/chrono//boost_chrono
+ : requirements
+# <library>/boost/chrono//boost_chrono
 # <library>/boost/system//boost_system
       <link>static
- <target-os>freebsd:<linkflags>"-lrt"
+ <target-os>freebsd:<linkflags>"-lrt"
       <target-os>linux:<linkflags>"-lrt"
       <toolset>gcc:<cxxflags>-fvisibility=hidden
       <toolset>intel-linux:<cxxflags>-fvisibility=hidden
       <toolset>sun:<cxxflags>-xldscope=hidden
     : default-build release
  ;
-
+
 run performance_test.cpp : $(TEST_DIR) ;
-
+

Modified: trunk/libs/conversion/test/Jamfile.v2
==============================================================================
--- trunk/libs/conversion/test/Jamfile.v2 (original)
+++ trunk/libs/conversion/test/Jamfile.v2 2012-05-20 12:25:21 EDT (Sun, 20 May 2012)
@@ -11,20 +11,20 @@
 project
     : requirements
         <library>/boost/test//boost_unit_test_framework
- <link>static
+ <link>static
         <toolset>gcc-4.8:<define>BOOST_STL_SUPPORTS_NEW_UNICODE_LOCALES
     ;
 
-# Thanks to Steven Watanabe for helping with <nowchar> feature
+# Thanks to Steven Watanabe for helping with <nowchar> feature
 feature.feature nowchar : on :
  composite optional propagated link-incompatible ;
 feature.compose <nowchar>on : <cxxflags>/Zc:wchar_t- ;
-
+
 test-suite conversion
   : [ run implicit_cast.cpp ]
     [ compile-fail implicit_cast_fail.cpp ]
     [ run ../cast_test.cpp ]
- [ run ../numeric_cast_test.cpp ]
+ [ run ../numeric_cast_test.cpp ]
     [ run ../lexical_cast_test.cpp ]
     [ run lexical_cast_loopback_test.cpp ]
     [ run lexical_cast_abstract_test.cpp ]
@@ -39,7 +39,7 @@
     [ compile lexical_cast_typedefed_wchar_test.cpp : <toolset>msvc:<nowchar>on ]
     [ run lexical_cast_typedefed_wchar_test_runtime.cpp : : : <toolset>msvc:<nowchar>on <toolset>msvc,<stdlib>stlport:<build>no ]
     [ run lexical_cast_no_locale_test.cpp : : : <define>BOOST_NO_STD_LOCALE <define>BOOST_LEXICAL_CAST_ASSUME_C_LOCALE ]
- [ run lexical_cast_no_exceptions_test.cpp : : : <define>BOOST_NO_EXCEPTIONS
+ [ run lexical_cast_no_exceptions_test.cpp : : : <define>BOOST_NO_EXCEPTIONS
       <toolset>gcc-4.3:<cflags>-fno-exceptions
       <toolset>gcc-4.4:<cflags>-fno-exceptions
       <toolset>gcc-4.5:<cflags>-fno-exceptions

Modified: trunk/libs/conversion/test/implicit_cast.cpp
==============================================================================
--- trunk/libs/conversion/test/implicit_cast.cpp (original)
+++ trunk/libs/conversion/test/implicit_cast.cpp 2012-05-20 12:25:21 EDT (Sun, 20 May 2012)
@@ -28,7 +28,7 @@
 
     type<foo> f = check_return(boost::implicit_cast<foo>("hello"));
     type<long> z = check_return(boost::implicit_cast<long>(foo("hello")));
-
+
     // warning supression:
     (void)x;
     (void)f;

Modified: trunk/libs/conversion/test/lexical_cast_containers_test.cpp
==============================================================================
--- trunk/libs/conversion/test/lexical_cast_containers_test.cpp (original)
+++ trunk/libs/conversion/test/lexical_cast_containers_test.cpp 2012-05-20 12:25:21 EDT (Sun, 20 May 2012)
@@ -31,7 +31,7 @@
 }
 
 void testing_boost_containers_basic_string()
-{
+{
     BOOST_CHECK("100" == lexical_cast<boost::container::string>("100"));
     BOOST_CHECK(L"100" == lexical_cast<boost::container::wstring>(L"100"));
 

Modified: trunk/libs/conversion/test/lexical_cast_float_types_test.cpp
==============================================================================
--- trunk/libs/conversion/test/lexical_cast_float_types_test.cpp (original)
+++ trunk/libs/conversion/test/lexical_cast_float_types_test.cpp 2012-05-20 12:25:21 EDT (Sun, 20 May 2012)
@@ -237,7 +237,7 @@
     CHECK_CLOSE_ABS_DIFF(-10101.0E-011, test_t);
     CHECK_CLOSE_ABS_DIFF(-10101093, test_t);
     CHECK_CLOSE_ABS_DIFF(10101093, test_t);
-
+
     CHECK_CLOSE_ABS_DIFF(-.34, test_t);
     CHECK_CLOSE_ABS_DIFF(.34, test_t);
     CHECK_CLOSE_ABS_DIFF(.34e10, test_t);

Modified: trunk/libs/conversion/test/lexical_cast_iterator_range_test.cpp
==============================================================================
--- trunk/libs/conversion/test/lexical_cast_iterator_range_test.cpp (original)
+++ trunk/libs/conversion/test/lexical_cast_iterator_range_test.cpp 2012-05-20 12:25:21 EDT (Sun, 20 May 2012)
@@ -138,7 +138,7 @@
 #endif
 }
 
-void test_char_iterator_ranges()
+void test_char_iterator_ranges()
 {
     typedef char test_char_type;
     test_char_type data1[] = "1";
@@ -149,7 +149,7 @@
 
 
 
-void test_unsigned_char_iterator_ranges()
+void test_unsigned_char_iterator_ranges()
 {
     typedef unsigned char test_char_type;
     test_char_type data1[] = "1";
@@ -158,7 +158,7 @@
     test_it_range_using_char(data1, data2);
 }
 
-void test_signed_char_iterator_ranges()
+void test_signed_char_iterator_ranges()
 {
     typedef signed char test_char_type;
     test_char_type data1[] = "1";
@@ -167,7 +167,7 @@
     test_it_range_using_char(data1, data2);
 }
 
-void test_wchar_iterator_ranges()
+void test_wchar_iterator_ranges()
 {
 #ifndef BOOST_LCAST_NO_WCHAR_T
     typedef wchar_t test_char_type;
@@ -179,7 +179,7 @@
     BOOST_CHECK(true);
 }
 
-void test_char16_iterator_ranges()
+void test_char16_iterator_ranges()
 {
 #if !defined(BOOST_NO_CHAR16_T) && !defined(BOOST_NO_UNICODE_LITERALS)
     typedef char16_t test_char_type;
@@ -191,7 +191,7 @@
     BOOST_CHECK(true);
 }
 
-void test_char32_iterator_ranges()
+void test_char32_iterator_ranges()
 {
 #if !defined(BOOST_NO_CHAR32_T) && !defined(BOOST_NO_UNICODE_LITERALS)
     typedef char32_t test_char_type;

Modified: trunk/libs/conversion/test/lexical_cast_no_exceptions_test.cpp
==============================================================================
--- trunk/libs/conversion/test/lexical_cast_no_exceptions_test.cpp (original)
+++ trunk/libs/conversion/test/lexical_cast_no_exceptions_test.cpp 2012-05-20 12:25:21 EDT (Sun, 20 May 2012)
@@ -22,7 +22,7 @@
 
 #ifndef BOOST_NO_EXCEPTIONS
 #error "This test must be compiled with -DBOOST_NO_EXCEPTIONS"
-#endif
+#endif
 
 bool g_was_exception = false;
 
@@ -60,25 +60,25 @@
 void test_exceptions_off()
 {
     Escape v("");
-
- g_was_exception = false;
+
+ g_was_exception = false;
     lexical_cast<char>(v);
     BOOST_CHECK(g_was_exception);
-
+
     g_was_exception = false;
     lexical_cast<unsigned char>(v);
     BOOST_CHECK(g_was_exception);
-
+
     v = lexical_cast<Escape>(100);
     BOOST_CHECK_EQUAL(lexical_cast<int>(v), 100);
     BOOST_CHECK_EQUAL(lexical_cast<unsigned int>(v), 100u);
-
+
     v = lexical_cast<Escape>(0.0);
     BOOST_CHECK_EQUAL(lexical_cast<double>(v), 0.0);
 
     BOOST_CHECK_EQUAL(lexical_cast<short>(100), 100);
     BOOST_CHECK_EQUAL(lexical_cast<float>(0.0), 0.0);
-
+
     g_was_exception = false;
     lexical_cast<short>(700000);
     BOOST_CHECK(g_was_exception);

Modified: trunk/libs/conversion/test/lexical_cast_no_locale_test.cpp
==============================================================================
--- trunk/libs/conversion/test/lexical_cast_no_locale_test.cpp (original)
+++ trunk/libs/conversion/test/lexical_cast_no_locale_test.cpp 2012-05-20 12:25:21 EDT (Sun, 20 May 2012)
@@ -23,12 +23,12 @@
 using namespace boost;
 
 // Testing compilation and some basic usage with BOOST_NO_STD_LOCALE
-// Tests are mainly copyied from lexical_cast_empty_input_test.cpp (something
+// Tests are mainly copyied from lexical_cast_empty_input_test.cpp (something
 // new added to test_empty_3)
 
 #ifndef BOOST_NO_STD_LOCALE
 #error "This test must be compiled with -DBOOST_NO_STD_LOCALE"
-#endif
+#endif
 
 
 template <class T>
@@ -106,15 +106,15 @@
 {
     Escape v("");
     do_test_on_empty_input(v);
-
+
     BOOST_CHECK_THROW(lexical_cast<char>(v), bad_lexical_cast);
     BOOST_CHECK_THROW(lexical_cast<unsigned char>(v), bad_lexical_cast);
     BOOST_CHECK_THROW(lexical_cast<signed char>(v), bad_lexical_cast);
-
+
     v = lexical_cast<Escape>(100);
     BOOST_CHECK_EQUAL(lexical_cast<int>(v), 100);
     BOOST_CHECK_EQUAL(lexical_cast<unsigned int>(v), 100u);
-
+
     v = lexical_cast<Escape>(0.0);
     BOOST_CHECK_EQUAL(lexical_cast<double>(v), 0.0);
 }

Modified: trunk/libs/conversion/test/lexical_cast_typedefed_wchar_test_runtime.cpp
==============================================================================
--- trunk/libs/conversion/test/lexical_cast_typedefed_wchar_test_runtime.cpp (original)
+++ trunk/libs/conversion/test/lexical_cast_typedefed_wchar_test_runtime.cpp 2012-05-20 12:25:21 EDT (Sun, 20 May 2012)
@@ -30,7 +30,7 @@
 
     BOOST_CHECK_EQUAL(boost::lexical_cast<int>(L'A'), 65);
     BOOST_CHECK_EQUAL(boost::lexical_cast<int>(L'B'), 66);
-
+
     BOOST_CHECK_EQUAL(boost::lexical_cast<wchar_t>(L"65"), 65);
     BOOST_CHECK_EQUAL(boost::lexical_cast<wchar_t>(L"66"), 66);
 #endif


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk