Skip to content

Commit

Permalink
libexpr: Lessen const bound on Value::listElems() const
Browse files Browse the repository at this point in the history
I do not like this being a requirement, but it is necessary to make the
C api work with the least amount of ABI changes.

listElems() const returns a constant pointer to N constant pointers of
Value. This bound is lessened (within defined behavior) to a constant
pointer to N *mutable* pointers of Value. The upstream reasoning behind
this is reasonable enough, though I strongly distrust it.

It might be better to drop the `const` off of the C ABI instead.

Change-Id: I8e750b086c1b8d13972aa748ce8f6139f6bcbadb
  • Loading branch information
puckipedia committed Mar 17, 2024
1 parent 7f9e09a commit de17a2f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libexpr/value.hh
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ public:
return internalType == tList1 || internalType == tList2 ? smallList : bigList.elems;
}

const Value * const * listElems() const
Value * const * listElems() const
{
return internalType == tList1 || internalType == tList2 ? smallList : bigList.elems;
}
Expand Down

0 comments on commit de17a2f

Please sign in to comment.