[preprocessor] PUSH_BACK/_FRONT on empty array broken in 1.49

Hi! BOOST_PP_ARRAY_PUSH_BACK & BOOST_PP_ARRAY_PUSH_FRONT on empty array leads to invalid code if Boost 1.49 is used. In 1.48 and older it works as expected. An incident was already filed and a sample attached: https://svn.boost.org/trac/boost/ticket/6760 Thanks for solving. Let me know if I can be of further assist. Jan

On Tue, 03 Apr 2012 17:34:58 +0200, Jan Boehme wrote:
Hi!
BOOST_PP_ARRAY_PUSH_BACK & BOOST_PP_ARRAY_PUSH_FRONT on empty array leads to invalid code if Boost 1.49 is used.
In 1.48 and older it works as expected.
An incident was already filed and a sample attached: https://svn.boost.org/trac/boost/ticket/6760
Thanks for solving. Let me know if I can be of further assist. Jan
Ticket closed--not a bug. It *happened* to work in older versions primarily because the tuple implementation had a backdoor to all () as a nil tuple is *some* cases. However, () is not a nil tuple--particularly not in C99+ or C++11+. There is no such thing as a zero-element array (or tuple), and the array implementations defer to the tuple implementations. (0, ()) is invalid, as it should be (1, ()) just as with (2, (,)) and (3, (,,)). If there was a nil array, all of the array operations would have to go out of there way to handle it specially. Regards, Paul Mensonides

On 04/03/2012 10:18 PM, Paul Mensonides wrote:
Ticket closed--not a bug.
It *happened* to work in older versions primarily because the tuple implementation had a backdoor to all () as a nil tuple is *some* cases. However, () is not a nil tuple--particularly not in C99+ or C++11+. There is no such thing as a zero-element array (or tuple), and the array implementations defer to the tuple implementations. (0, ()) is invalid, as it should be (1, ()) just as with (2, (,)) and (3, (,,)).
If there was a nil array, all of the array operations would have to go out of there way to handle it specially.
Conclusive. Thank you for explaining. Regards, Jan.
participants (2)
-
Jan Boehme
-
Paul Mensonides