Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4421: fix for #4400
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-05-19 10:09:37
#4421: fix for #4400
--------------------------------------+---------------------------
Reporter: Wolf Lammen <ookami1@â¦> | Owner: no-maintainer
Type: Patches | Status: new
Milestone: Boost 1.44.0 | Component: preprocessor
Version: Boost 1.44.0 | Severity: Problem
Resolution: | Keywords:
--------------------------------------+---------------------------
Comment (by ookami1@â¦):
I do see your point, but let me comment on it nevertheless. This is not
meant to talk you into applying this patches. It is fine with me, and
actually I was quite surprised and pleased to see somebody care about this
report at all after such a long time.
Usually, you would do parameter checking in order to enforce an API. This
cannot really be done in preprocessor code, as this is very expensive and
requires lots of macro replacements, unduely slowing down compiling.
So it is up to users to carefully use the preprocessor code. Apart from
sloppy mindsets found all over the place, correct handling is not made
easy. Who really sees at a glance that BOOST_PP_SEQ_REST_N must not be
called with an index pointing to the last element. And are there other
places with obscure restrictions? Then we have the exceptions (see the
documentation for BOOST_PP_SEQ_NIL) which may fool people into thinking,
they can do likewise somewhere else.
On top, it does not help that BOOST_PP_SEQ_REST_N in reality behaves as
expected in the vast majority of (and practically all relevant) cases. So
code appears to be correct, but it is not.
I proposed my patches because I felt it is more appropriate to be fault
tolerant in such a situation.
cheers Wolf
Replying to [comment:9 eldiener]:
> Fixed in the latest preprocessor code in the 'develop' branch.
>
> While I appreciate the patches I did not use them. It is an undefined
result to call BOOST_PP_SEQ_REST_N with an 'n' which is equal to the size
of the 'seq'. The fact that this returns nothing is an implementation
detail, since a seq cannot be empty and BOOST_PP_SEQ_REST_N clearly states
that it expands to a seq. I will update the documentation accordingly. I
am not willing to change BOOST_PP_SEQ_REST_N to accomodate a situation
which should be undefined.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/4421#comment:10> 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