Opened 6 years ago

Closed 5 years ago

#12388 closed Bugs (fixed)

useless static const generated by BOOST_SPIRIT_DEFINE_?

Reported by: cppljevans@… Owned by: Joel de Guzman
Milestone: To Be Determined Component: spirit
Version: Boost 1.61.0 Severity: Cosmetic
Keywords: Cc:

Description

The purpose of creating of a static variable here:

https://github.com/boostorg/spirit/blob/develop/include/boost/spirit/home/x3/nonterminal/rule.hpp#L164

is not apparent. Why wouldn't the following replacement:

auto const& def_=BOOST_PP_CAT(rule_name, _def);

work just as well. If not, some source code comments explaining the need for creating a new instance of a struct would help maintainers and people trying to understand the code.

Change History (3)

in reply to:  description comment:1 by cppljevans@…, 6 years ago

Replying to cppljevans@…:

The purpose of creating of a static variable here:

https://github.com/boostorg/spirit/blob/develop/include/boost/spirit/home/x3/nonterminal/rule.hpp#L164

is not apparent. Why wouldn't the following replacement:

auto const& def_=BOOST_PP_CAT(rule_name, _def);

work just as well. If not, some source code comments explaining the need for creating a new instance of a struct would help maintainers and people trying to understand the code.

Closer inspection of rule_definition shows it handles attributes. Sorry for noise. Please ignore this ticket.

comment:2 by viboes, 6 years ago

Component: Nonespirit
Owner: set to Joel de Guzman

comment:3 by Joel de Guzman, 5 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.