Skip to content

Boby of one-liner ranged-based for discarded #161

@hrjonashansen

Description

@hrjonashansen

The following snippet creates a c-style array and prints the elements one by one. However, the printing part is not included in the output of cppinsights.io.

Snippet:

#include <iostream>

int main(int argc, char** argv)
{
    char arr[10]{2,4,6,8};
    for (auto i : arr)
        std::cout << i << " ";
}

Output:

#include <iostream>

int main(int argc, char ** argv)
{
  char arr[10] = {2, 4, 6, 8, '\0', '\0', '\0', '\0', '\0', '\0'};
  {
    char (&__range1)[10] = arr;
    char * __begin1 = __range1;
    char * __end1 = __range1 + 10l;
    for(; __begin1 != __end1; ++__begin1) 
    {
      char i = *__begin1;
    }
    
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions