Page MenuHomePhabricator

[libcxx] Introducing _LIBCPP_INLINE_VARIABLE
Needs ReviewPublic

Authored by AntonBikineev on Nov 18 2016, 8:18 AM.

Details

Reviewers
mclow.lists
Summary

Hey Eric,
This is so *cosmetic*, but wouldn't it be more consistent with other macros like _LIBCPP_CONSTEXPR, etc..?

Diff Detail

Event Timeline

AntonBikineev retitled this revision from to [libcxx] Introducing _LIBCPP_INLINE_VARIABLE.
AntonBikineev updated this object.
EricWF edited edge metadata.Nov 18 2016, 10:18 AM

I didn't add _LIBCPP_INLINE_VARIABLE because we shouldn't make a habit of having variables that are sometimes inline and sometimes not. So it should be as ugly as possible when you have to do it. Hopefully the current usages in <utility> will be all we ever need.

EricWF resigned from this revision.Nov 23 2016, 1:43 AM
EricWF removed a reviewer: EricWF.

Resigning as review because I don't think this patch should proceed.

AntonBikineev added a subscriber: EricWF.EditedNov 23 2016, 7:41 AM

I didn't add _LIBCPP_INLINE_VARIABLE because we shouldn't make a habit of having variables that are sometimes inline and sometimes not. So it should be as ugly as possible when you have to do it. Hopefully the current usages in <utility> will be all we ever need.

Eric, I can see a potential for this macro. We have a lot of tag types instances in Standard Library -- seq, par, piecewise_construct, nullopt, ignore to name a few. All of them are considered to become inline to prevent odr-violations. There are 2 National Body comments addressing this issue (GB28, FI9). I absolutely agree about monstrosity of such macros, but from my perspective it's inevitable.

I didn't add _LIBCPP_INLINE_VARIABLE because we shouldn't make a habit of having variables that are sometimes inline and sometimes not. So it should be as ugly as possible when you have to do it. Hopefully the current usages in <utility> will be all we ever need.

Eric, I can see a potential for this macro. We have a lot of tag types instances in Standard Library -- seq, par, piecewise_construct, nullopt, ignore to name a few. All of them are considered to become inline to prevent odr-violations. There are 2 National Body comments addressing this issue (GB28, FI9). I absolutely agree about monstrosity of such macros, but from my perspective it's inevitable.

I'll be happy to reconsider when that actually comes to fruition.