question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Subscript expressions (aka index operator) of complex expressions

See original GitHub issue

As of now, we don’t seem to support something like this:

typedef struct { int[10] x; } foo;
int main() {
  foo a;
  a.x[0] = 0;
}

Look for the number `230` in the code to find clues to implement this feature.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
te9ccommented, Aug 19, 2022

Hi! I’d like to contribute but looks like i don’t understand the essense of the problem. I use the last build of Cesium and code like this works without expressions.

int main()
{
    int array[6];

    array[1 + 1] = 10;

    return array[1 + 1];
}

0reactions
ForNeVeRcommented, Aug 20, 2022

Generally, the target expression should just emit something indexable (such as: return an IValue or, dunno, something of kind IIndexableValue, if we think it’s required), and the SunscrptingExpression should perform an index operation (say, some address operation). It shouldn’t depend on the target expression type.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Subscript Operator []
Positive and negative subscripts​​ The subscript operator is commutative. Therefore, the expressions array[index] and index[array] are guaranteed ...
Read more >
Overloading Subscript or array index operator [] in C++
This operator is generally used with arrays to retrieve and manipulate the array elements. This is a binary or n-ary operator and is...
Read more >
C++23: multi-dimensional subscript operator | by Šimon Tóth
C++23 introduced a significant change to the subscript operator. The operator can now take multiple arguments separated by a comma. This was not...
Read more >
Subscript Operator
Use a subscript operator to access elements in an array or a map. You can access a specific element or a range of...
Read more >
Array subscripting operator [ ]
The expression within the brackets is referred to as a subscript. The first element of an array has the subscript zero. Array bounds...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found