Re: [Boost-bugs] [Boost C++ Libraries] #4400: BOOST_PP_SEQ_REPLACE fails in corner cases

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4400: BOOST_PP_SEQ_REPLACE fails in corner cases
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-05-24 23:07:04


#4400: BOOST_PP_SEQ_REPLACE fails in corner cases
--------------------------------------+---------------------------
  Reporter: Wolf Lammen <ookami1@…> | Owner: no-maintainer
      Type: Bugs | Status: new
 Milestone: Boost 1.44.0 | Component: preprocessor
   Version: Boost 1.44.0 | Severity: Problem
Resolution: | Keywords:
--------------------------------------+---------------------------

Comment (by ookami1@…):

> In your approach an empty seq is perfectly fine, despite the fact that
 testing for emptiness is highly flawed..
 I'm well aware of the limitations of empty sequences, and therefore do not
 propose their support. As I wrote in #4421

 "seq_first_rest_n.patch fixes BOOST_PP_SEQ_FIRST_N and
 BOOST_PP_SEQ_REST_N, so they both accept sequences of length 256 now. As a
 bonus feature, for preprocessors sufficiantly handling empty arguments (or
 those expanding to nothing), both macros process empty sequences as well.
 Usage of empty sequences is outside of the specs of the preprocessor code,
 and is not generally supported by the preprocessor library."

 This is not about general support of empty sequences, let alone about
 breaking interfaces (When only did I propose that??). This is about more
 robustness. And that is seemingly needed, as you can see from the
 following bug, again because of bad usage of BOOST_PP_SEQ_REST_N (SEQ_256
 is defined as above in the bug report)

 {{{
 // does not remove the last element
 char x[] = BOOST_PP_STRINGIZE(BOOST_PP_SEQ_REMOVE(SEQ_256,255));
 }}}

 People, Boost programmers not excluded, seem to misunderstand/disregard
 the interface of these macros on a regular base, fortunately without
 consequences most of the time.

 Ok, that is why I had preferred seeing after both macros. I guess they are
 mostly used when sequences are rearranged. In that context, at the head or
 tail of a sequence, an empty expansion (!= empty sequence) is a sensible
 result, at least better than the same result, occasionally replaced with
 junk.

 And yes, I know that variadic macros provide better support. And that
 template programming is often a viable replacement for macros. This here
 is all about technology from the past decade. The bug number stands for
 that.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4400#comment:11>
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:18 UTC