Menu

array-to-pointer decay

Fraser
2022-02-26
2022-02-26
  • Fraser

    Fraser - 2022-02-26

    Does CPPCheck recommend using std::begin and std::cbegin instead of using array-to-pointer decay? For instance this code:

    char buffer[100];

    std:rotate(std::begin(buffer), std::begin(buffer) + 10, std::end(buffer));

    is more meaningful than

    std:rotate(buffer, buffer + 10, buffer + 100);

     
  • Fraser

    Fraser - 2022-02-26

    There are some cases where there cannot be a straightforward addition of std::begin.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.