Skip to content

Commit

Permalink
Kilo more c++ (#333)
Browse files Browse the repository at this point in the history
  • Loading branch information
flagarde committed Nov 14, 2023
1 parent efdc4e2 commit c4e0e89
Showing 1 changed file with 224 additions and 225 deletions.
Loading

1 comment on commit c4e0e89

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cpp-Linter Report ⚠️

Some files did not pass the configured checks!

clang-tidy reports: 334 concern(s)
  • examples/kilo.cpp

    /examples/kilo.cpp:36:1: warning: [fuchsia-statically-constructed-objects]

    static objects are disallowed; if possible, use a constexpr constructor instead

       36 | const std::string KILO_VERSION{"0.0.1"};
          | ^

    /examples/kilo.cpp:36:19: warning: [cert-err58-cpp]

    initialization of 'KILO_VERSION' with static storage duration may throw an exception that cannot be caught

       36 | const std::string KILO_VERSION{"0.0.1"};
          |                   ^
    /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/basic_string.h:631:7: note: possibly throwing constructor declared here
      631 |       basic_string(const _CharT* __s, const _Alloc& __a = _Alloc())
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:60:3: warning: constructor does not initialize these fields: flags [cppcoreguidelines-pro-type-member-init,hicpp-member-init]
       60 |   editorSyntax() : keywords(nullptr) {}
          |   ^
       61 |   editorSyntax(const std::string& type, const std::vector<std::string>& match, const char** key, const std::string& sc, const std::string& mcs, const std::string& mce, const std::size_t& flag) : filetype(type), filematch(match), keywords(key), singleline_comment_start(sc), multiline_comment_start(mcs), multiline_comment_end(mce), flags(flag) { m_empty = false; }
       62 |   bool                     empty() const noexcept { return m_empty; }
       63 |   std::string              filetype;
       64 |   std::vector<std::string> filematch;
       65 |   const char**             keywords;
       66 |   std::string              singleline_comment_start;
       67 |   std::string              multiline_comment_start;
       68 |   std::string              multiline_comment_end;
       69 |   std::size_t              flags;
          |                                 
          |                                 {}

    /examples/kilo.cpp:61:98: warning: [bugprone-easily-swappable-parameters]

    2 adjacent parameters of 'editorSyntax' of similar type ('const std::string &') are easily swapped by mistake

       61 |   editorSyntax(const std::string& type, const std::vector<std::string>& match, const char** key, const std::string& sc, const std::string& mcs, const std::string& mce, const std::size_t& flag) : filetype(type), filematch(match), keywords(key), singleline_comment_start(sc), multiline_comment_start(mcs), multiline_comment_end(mce), flags(flag) { m_empty = false; }
          |                                                                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:61:117: note: the first parameter in the range is 'sc'
       61 |   editorSyntax(const std::string& type, const std::vector<std::string>& match, const char** key, const std::string& sc, const std::string& mcs, const std::string& mce, const std::size_t& flag) : filetype(type), filematch(match), keywords(key), singleline_comment_start(sc), multiline_comment_start(mcs), multiline_comment_end(mce), flags(flag) { m_empty = false; }
          |                                                                                                                     ^~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:61:140: note: the last parameter in the range is 'mcs'
       61 |   editorSyntax(const std::string& type, const std::vector<std::string>& match, const char** key, const std::string& sc, const std::string& mcs, const std::string& mce, const std::size_t& flag) : filetype(type), filematch(match), keywords(key), singleline_comment_start(sc), multiline_comment_start(mcs), multiline_comment_end(mce), flags(flag) { m_empty = false; }
          |                                                                                                                                            ^~~

    /examples/kilo.cpp:61:117: warning: [readability-identifier-length]

    parameter name 'sc' is too short, expected at least 3 characters

       61 |   editorSyntax(const std::string& type, const std::vector<std::string>& match, const char** key, const std::string& sc, const std::string& mcs, const std::string& mce, const std::size_t& flag) : filetype(type), filematch(match), keywords(key), singleline_comment_start(sc), multiline_comment_start(mcs), multiline_comment_end(mce), flags(flag) { m_empty = false; }
          |                                                                                                                     ^

    /examples/kilo.cpp:61:347: warning: [cppcoreguidelines-prefer-member-initializer]

    'm_empty' should be initialized in a member initializer of the constructor

       61 |   editorSyntax(const std::string& type, const std::vector<std::string>& match, const char** key, const std::string& sc, const std::string& mcs, const std::string& mce, const std::size_t& flag) : filetype(type), filematch(match), keywords(key), singleline_comment_start(sc), multiline_comment_start(mcs), multiline_comment_end(mce), flags(flag) { m_empty = false; }
          |                                                                                                                                                                                                                                                                                                                                                           ^~~~~~~~~~~~~~~~
          |                                                                                                                                                                                                                                                                                                                                                        , m_empty(false)
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:63:28: warning: member variable 'filetype' has public visibility [cppcoreguidelines-non-private-member-variables-in-classes,misc-non-private-member-variables-in-classes]
       63 |   std::string              filetype;
          |                            ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:64:28: warning: member variable 'filematch' has public visibility [cppcoreguidelines-non-private-member-variables-in-classes,misc-non-private-member-variables-in-classes]
       64 |   std::vector<std::string> filematch;
          |                            ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:65:28: warning: member variable 'keywords' has public visibility [cppcoreguidelines-non-private-member-variables-in-classes,misc-non-private-member-variables-in-classes]
       65 |   const char**             keywords;
          |                            ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:66:28: warning: member variable 'singleline_comment_start' has public visibility [cppcoreguidelines-non-private-member-variables-in-classes,misc-non-private-member-variables-in-classes]
       66 |   std::string              singleline_comment_start;
          |                            ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:67:28: warning: member variable 'multiline_comment_start' has public visibility [cppcoreguidelines-non-private-member-variables-in-classes,misc-non-private-member-variables-in-classes]
       67 |   std::string              multiline_comment_start;
          |                            ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:68:28: warning: member variable 'multiline_comment_end' has public visibility [cppcoreguidelines-non-private-member-variables-in-classes,misc-non-private-member-variables-in-classes]
       68 |   std::string              multiline_comment_end;
          |                            ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:69:28: warning: member variable 'flags' has public visibility [cppcoreguidelines-non-private-member-variables-in-classes,misc-non-private-member-variables-in-classes]
       69 |   std::size_t              flags;
          |                            ^

    /examples/kilo.cpp:75:1: warning: [modernize-use-using]

    use 'using' instead of 'typedef'

       75 | typedef struct erow
          | ^~~~~~~~~~~~~~~~~~~
       76 | {
          | ~
       77 |   int            idx;
          |   ~~~~~~~~~~~~~~~~~~~
       78 |   int            size;
          |   ~~~~~~~~~~~~~~~~~~~~
       79 |   int            rsize;
          |   ~~~~~~~~~~~~~~~~~~~~~
       80 |   char*          chars;
          |   ~~~~~~~~~~~~~~~~~~~~~
       81 |   char*          render;
          |   ~~~~~~~~~~~~~~~~~~~~~~
       82 |   unsigned char* hl;
          |   ~~~~~~~~~~~~~~~~~~
       83 |   int            hl_open_comment;
          |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       84 | } erow;
          | ~~~~~~

    /examples/kilo.cpp:75:16: warning: [altera-struct-pack-align]

    accessing fields in struct 'erow' is inefficient due to padding; only needs 40 bytes but is using 48 bytes

       75 | typedef struct erow
          |                ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:75:16: note: use "__attribute__((packed))" to reduce the amount of padding applied to struct 'erow'
    note: this fix will not be applied because it overlaps with another fix

    /examples/kilo.cpp:75:16: warning: [altera-struct-pack-align]

    accessing fields in struct 'erow' is inefficient due to poor alignment; currently aligned to 8 bytes, but recommended alignment is 64 bytes

       75 | typedef struct erow
          |                ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:75:16: note: use "__attribute__((aligned(64)))" to align struct 'erow' to 64 bytes
    note: this fix will not be applied because it overlaps with another fix

    /examples/kilo.cpp:101:16: warning: [misc-non-private-member-variables-in-classes]

    member variable 'cx' has public visibility

      101 |   std::size_t  cx{0};
          |                ^

    /examples/kilo.cpp:102:16: warning: [misc-non-private-member-variables-in-classes]

    member variable 'cy' has public visibility

      102 |   std::size_t  cy{0};
          |                ^

    /examples/kilo.cpp:103:16: warning: [misc-non-private-member-variables-in-classes]

    member variable 'rx' has public visibility

      103 |   int          rx{0};
          |                ^

    /examples/kilo.cpp:104:16: warning: [misc-non-private-member-variables-in-classes]

    member variable 'rowoff' has public visibility

      104 |   std::size_t  rowoff{0};
          |                ^

    /examples/kilo.cpp:105:16: warning: [misc-non-private-member-variables-in-classes]

    member variable 'coloff' has public visibility

      105 |   std::size_t  coloff{0};
          |                ^

    /examples/kilo.cpp:106:16: warning: [misc-non-private-member-variables-in-classes]

    member variable 'screenrows' has public visibility

      106 |   std::size_t  screenrows{0};
          |                ^

    /examples/kilo.cpp:107:16: warning: [misc-non-private-member-variables-in-classes]

    member variable 'screencols' has public visibility

      107 |   std::size_t  screencols{0};
          |                ^

    /examples/kilo.cpp:108:16: warning: [misc-non-private-member-variables-in-classes]

    member variable 'numrows' has public visibility

      108 |   std::size_t  numrows{0};
          |                ^

    /examples/kilo.cpp:109:16: warning: [misc-non-private-member-variables-in-classes]

    member variable 'row' has public visibility

      109 |   erow*        row{nullptr};
          |                ^

    /examples/kilo.cpp:110:16: warning: [misc-non-private-member-variables-in-classes]

    member variable 'dirty' has public visibility

      110 |   int          dirty{0};
          |                ^

    /examples/kilo.cpp:111:16: warning: [misc-non-private-member-variables-in-classes]

    member variable 'filename' has public visibility

      111 |   std::string  filename;
          |                ^

    /examples/kilo.cpp:112:16: warning: [misc-non-private-member-variables-in-classes]

    member variable 'statusmsg' has public visibility

      112 |   std::string  statusmsg;
          |                ^

    /examples/kilo.cpp:113:3: warning: [misc-include-cleaner]

    no header providing "time_t" is directly included

       28 |   time_t       statusmsg_time{0};
          |   ^

    /examples/kilo.cpp:113:16: warning: [misc-non-private-member-variables-in-classes]

    member variable 'statusmsg_time' has public visibility

      113 |   time_t       statusmsg_time{0};
          |                ^

    /examples/kilo.cpp:114:16: warning: [misc-non-private-member-variables-in-classes]

    member variable 'syntax' has public visibility

      114 |   editorSyntax syntax;
          |                ^

    /examples/kilo.cpp:120:1: warning: [fuchsia-statically-constructed-objects]

    static objects are disallowed; if possible, use a constexpr constructor instead

      120 | class editorConfig E;
          | ^

    /examples/kilo.cpp:120:20: warning: [cert-err58-cpp]

    initialization of 'E' with static storage duration may throw an exception that cannot be caught

      120 | class editorConfig E;
          |                    ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:89:3: note: possibly throwing constructor declared here
       89 |   editorConfig()
          |   ^

    /examples/kilo.cpp:120:20: warning: [readability-identifier-length]

    variable name 'E' is too short, expected at least 3 characters

      120 | class editorConfig E;
          |                    ^

    /examples/kilo.cpp:124:1: warning: [fuchsia-statically-constructed-objects]

    static objects are disallowed; if possible, use a constexpr constructor instead

      124 | const std::vector<std::string> C_HL_extensions = {".c", ".h", ".hpp", ".cpp"};
          | ^

    /examples/kilo.cpp:124:32: warning: [cert-err58-cpp]

    initialization of 'C_HL_extensions' with static storage duration may throw an exception that cannot be caught

      124 | const std::vector<std::string> C_HL_extensions = {".c", ".h", ".hpp", ".cpp"};
          |                                ^
    /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_vector.h:675:7: note: possibly throwing constructor declared here
      675 |       vector(initializer_list<value_type> __l,
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:125:7: warning: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays]
      125 | const char*                    C_HL_keywords[] = {"switch", "if", "while", "for", "break", "continue", "return", "else", "struct", "union", "typedef", "static", "enum", "class", "case", "int|", "long|", "double|", "float|", "char|", "unsigned|", "signed|", "void|", "bool|", nullptr};
          |       ^

    /examples/kilo.cpp:127:1: warning: [fuchsia-statically-constructed-objects]

    static objects are disallowed; if possible, use a constexpr constructor instead

      127 | std::array<editorSyntax, 1> HLDB = {
          | ^

    /examples/kilo.cpp:127:6: warning: [misc-include-cleaner]

    no header providing "std::array" is directly included

       25 | std::array<editorSyntax, 1> HLDB = {
          |      ^

    /examples/kilo.cpp:127:29: warning: [cert-err58-cpp]

    initialization of 'HLDB' with static storage duration may throw an exception that cannot be caught

      127 | std::array<editorSyntax, 1> HLDB = {
          |                             ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:61:3: note: possibly throwing constructor declared here
       61 |   editorSyntax(const std::string& type, const std::vector<std::string>& match, const char** key, const std::string& sc, const std::string& mcs, const std::string& mce, const std::size_t& flag) : filetype(type), filematch(match), keywords(key), singleline_comment_start(sc), multiline_comment_start(mcs), multiline_comment_end(mce), flags(flag) { m_empty = false; }
          |   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:128:38: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
      128 |   editorSyntax("c", C_HL_extensions, C_HL_keywords, "//", "/*", "*/", HL_HIGHLIGHT_NUMBERS | HL_HIGHLIGHT_STRINGS),
          |                                      ^

    /examples/kilo.cpp:128:71: warning: [hicpp-signed-bitwise]

    use of a signed integer operand with a binary bitwise operator

      128 |   editorSyntax("c", C_HL_extensions, C_HL_keywords, "//", "/*", "*/", HL_HIGHLIGHT_NUMBERS | HL_HIGHLIGHT_STRINGS),
          |                                                                       ^                    ~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:52:30: note: expanded from macro 'HL_HIGHLIGHT_NUMBERS'
       52 | #define HL_HIGHLIGHT_NUMBERS (1 << 0)
          |                              ^~~~~~~~

    /examples/kilo.cpp:128:94: warning: [hicpp-signed-bitwise]

    use of a signed integer operand with a binary bitwise operator

      128 |   editorSyntax("c", C_HL_extensions, C_HL_keywords, "//", "/*", "*/", HL_HIGHLIGHT_NUMBERS | HL_HIGHLIGHT_STRINGS),
          |                                                                                              ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:53:31: note: expanded from macro 'HL_HIGHLIGHT_STRINGS'
       53 | #define HL_HIGHLIGHT_STRINGS (1 << 1)
          |                               ^ ~~

    /examples/kilo.cpp:137:30: warning: [readability-identifier-length]

    parameter name 'c' is too short, expected at least 3 characters

      137 | bool is_separator(const int& c) { return isspace(c) || c == '\0' || strchr(",.()+-/*=~%<>[];", c) != nullptr; }
          |                              ^

    /examples/kilo.cpp:137:42: warning: [misc-include-cleaner]

    no header providing "isspace" is directly included

       25 | bool is_separator(const int& c) { return isspace(c) || c == '\0' || strchr(",.()+-/*=~%<>[];", c) != nullptr; }
          |                                          ^

    /examples/kilo.cpp:137:42: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      137 | bool is_separator(const int& c) { return isspace(c) || c == '\0' || strchr(",.()+-/*=~%<>[];", c) != nullptr; }
          |                                          ^
          |                                          (          != 0)

    /examples/kilo.cpp:139:6: warning: [misc-no-recursion]

    function 'editorUpdateSyntax' is within a recursive call chain

      139 | void editorUpdateSyntax(erow* row)
          |      ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:139:6: note: example recursive call chain, starting from function 'editorUpdateSyntax'
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:268:43: note: Frame #1: function 'editorUpdateSyntax' calls function 'editorUpdateSyntax' here:
      268 |   if(changed && row->idx + 1 < E.numrows) editorUpdateSyntax(&E.row[row->idx + 1]);
          |                                           ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:268:43: note: ... which was the starting point of the recursive call chain; there may be other cycles

    /examples/kilo.cpp:139:6: warning: [readability-function-cognitive-complexity]

    function 'editorUpdateSyntax' has cognitive complexity of 77 (threshold 25)

      139 | void editorUpdateSyntax(erow* row)
          |      ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:142:3: note: +1, including nesting penalty of 0, nesting level increased to 1
      142 |   if(row->hl == nullptr) { exit(-1); /*TODO: better handler*/ }
          |   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:145:3: note: +1, including nesting penalty of 0, nesting level increased to 1
      145 |   if(E.syntax.empty()) return;
          |   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:155:35: note: +1
      155 |   int in_comment = (row->idx > 0) && (E.row[row->idx - 1].hl_open_comment != 0);
          |                                   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:158:3: note: +1, including nesting penalty of 0, nesting level increased to 1
      158 |   while(i < static_cast<size_t>(row->rsize))
          |   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:161:37: note: +2, including nesting penalty of 1, nesting level increased to 2
      161 |     unsigned char prev_hl = (i > 0) ? row->hl[i - 1] : static_cast<unsigned char>(HL_NORMAL);
          |                                     ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:163:5: note: +2, including nesting penalty of 1, nesting level increased to 2
      163 |     if(scs.size() && !in_string && !in_comment)
          |     ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:163:33: note: +1
      163 |     if(scs.size() && !in_string && !in_comment)
          |                                 ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:165:7: note: +3, including nesting penalty of 2, nesting level increased to 3
      165 |       if(!strncmp(&row->render[i], &scs[0], scs.size()))
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:172:5: note: +2, including nesting penalty of 1, nesting level increased to 2
      172 |     if(mcs.size() && mce.size() && !in_string)
          |     ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:172:33: note: +1
      172 |     if(mcs.size() && mce.size() && !in_string)
          |                                 ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:174:7: note: +3, including nesting penalty of 2, nesting level increased to 3
      174 |       if(in_comment)
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:177:9: note: +4, including nesting penalty of 3, nesting level increased to 4
      177 |         if(!strncmp(&row->render[i], &mce[0], mce.size()))
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:185:9: note: +1, nesting level increased to 4
      185 |         else
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:191:12: note: +1, nesting level increased to 3
      191 |       else if(!strncmp(&row->render[i], &mcs[0], mcs.size()))
          |            ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:200:5: note: +2, including nesting penalty of 1, nesting level increased to 2
      200 |     if(E.syntax.flags & HL_HIGHLIGHT_STRINGS)
          |     ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:202:7: note: +3, including nesting penalty of 2, nesting level increased to 3
      202 |       if(in_string)
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:205:9: note: +4, including nesting penalty of 3, nesting level increased to 4
      205 |         if(c == '\\' && i + 1 < static_cast<size_t>(row->rsize))
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:205:22: note: +1
      205 |         if(c == '\\' && i + 1 < static_cast<size_t>(row->rsize))
          |                      ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:211:9: note: +4, including nesting penalty of 3, nesting level increased to 4
      211 |         if(c == in_string) in_string = 0;
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:216:7: note: +1, nesting level increased to 3
      216 |       else
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:218:9: note: +4, including nesting penalty of 3, nesting level increased to 4
      218 |         if(c == '"' || c == '\'')
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:218:21: note: +1
      218 |         if(c == '"' || c == '\'')
          |                     ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:228:5: note: +2, including nesting penalty of 1, nesting level increased to 2
      228 |     if(E.syntax.flags & HL_HIGHLIGHT_NUMBERS)
          |     ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:230:7: note: +3, including nesting penalty of 2, nesting level increased to 3
      230 |       if((isdigit(c) && (prev_sep || prev_hl == HL_NUMBER)) || (c == '.' && prev_hl == HL_NUMBER))
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:230:61: note: +1
      230 |       if((isdigit(c) && (prev_sep || prev_hl == HL_NUMBER)) || (c == '.' && prev_hl == HL_NUMBER))
          |                                                             ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:230:22: note: +1
      230 |       if((isdigit(c) && (prev_sep || prev_hl == HL_NUMBER)) || (c == '.' && prev_hl == HL_NUMBER))
          |                      ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:230:35: note: +1
      230 |       if((isdigit(c) && (prev_sep || prev_hl == HL_NUMBER)) || (c == '.' && prev_hl == HL_NUMBER))
          |                                   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:230:74: note: +1
      230 |       if((isdigit(c) && (prev_sep || prev_hl == HL_NUMBER)) || (c == '.' && prev_hl == HL_NUMBER))
          |                                                                          ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:239:5: note: +2, including nesting penalty of 1, nesting level increased to 2
      239 |     if(prev_sep)
          |     ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:242:7: note: +3, including nesting penalty of 2, nesting level increased to 3
      242 |       for(j = 0; keywords[j]; j++)
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:246:9: note: +4, including nesting penalty of 3, nesting level increased to 4
      246 |         if(kw2) klen--;
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:248:9: note: +4, including nesting penalty of 3, nesting level increased to 4
      248 |         if(!strncmp(&row->render[i], keywords[j], klen) && is_separator(row->render[i + klen]))
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:248:57: note: +1
      248 |         if(!strncmp(&row->render[i], keywords[j], klen) && is_separator(row->render[i + klen]))
          |                                                         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:250:35: note: +5, including nesting penalty of 4, nesting level increased to 5
      250 |           memset(&row->hl[i], kw2 ? HL_KEYWORD2 : HL_KEYWORD1, static_cast<size_t>(klen));
          |                                   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:255:7: note: +3, including nesting penalty of 2, nesting level increased to 3
      255 |       if(keywords[j] != nullptr)
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:268:3: note: +1, including nesting penalty of 0, nesting level increased to 1
      268 |   if(changed && row->idx + 1 < E.numrows) editorUpdateSyntax(&E.row[row->idx + 1]);
          |   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:268:14: note: +1
      268 |   if(changed && row->idx + 1 < E.numrows) editorUpdateSyntax(&E.row[row->idx + 1]);
          |              ^

    /examples/kilo.cpp:141:3: warning: [cppcoreguidelines-owning-memory]

    assigning newly created 'gsl::owner<>' to non-owner 'unsigned char *'

      141 |   row->hl = reinterpret_cast<unsigned char*>(realloc(row->hl, static_cast<size_t>(row->rsize)));
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:141:13: warning: [cppcoreguidelines-pro-type-reinterpret-cast]

    do not use reinterpret_cast

      141 |   row->hl = reinterpret_cast<unsigned char*>(realloc(row->hl, static_cast<size_t>(row->rsize)));
          |             ^

    /examples/kilo.cpp:141:46: warning: [bugprone-suspicious-realloc-usage]

    'row->hl' may be set to null if 'realloc' fails, which may result in a leak of the original buffer

      141 |   row->hl = reinterpret_cast<unsigned char*>(realloc(row->hl, static_cast<size_t>(row->rsize)));
          |   ~~~~~~~                                    ^       ~~~~~~~

    /examples/kilo.cpp:141:46: warning: [clang-analyzer-optin.portability.UnixAPI]

    Call to 'realloc' has an allocation size of 0 bytes

    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:955:8: note: Assuming the condition is false
      955 |     if(!Term::is_stdin_a_tty())
          |        ^~~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:955:5: note: Taking false branch
      955 |     if(!Term::is_stdin_a_tty())
          |     ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:961:8: note: Assuming the condition is false
      961 |     if(Term::argc >= 2) { editorOpen(Term::argv[1]); }
          |        ^~~~~~~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:961:5: note: Taking false branch
      961 |     if(Term::argc >= 2) { editorOpen(Term::argv[1]); }
          |     ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:966:11: note: Calling 'editorProcessKeypress'
      966 |     while(editorProcessKeypress()) { editorRefreshScreen(); }
          |           ^~~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:831:3: note: Control jumps to 'case Key:'  at line 833
      831 |   switch(event.type())
          |   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:836:7: note: Control jumps to 'case Enter:'  at line 838
      836 |       switch(key)
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:840:11: note: Calling 'editorInsertNewline'
      840 |           ::editorInsertNewline();
          |           ^~~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:451:6: note: Assuming field 'cx' is not equal to 0
      451 |   if(E.cx == 0) { editorInsertRow(E.cy, "", 0); }
          |      ^~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:451:3: note: Taking false branch
      451 |   if(E.cx == 0) { editorInsertRow(E.cy, "", 0); }
          |   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:459:5: note: Calling 'editorUpdateRow'
      459 |     editorUpdateRow(row);
          |     ^~~~~~~~~~~~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:337:18: note: Assuming 'j' is >= field 'size'
      337 |   for(int j = 0; j < row->size; j++)
          |                  ^~~~~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:337:3: note: Loop condition is false. Execution continues on line 340
      337 |   for(int j = 0; j < row->size; j++)
          |   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:342:6: note: Assuming the condition is false
      342 |   if(row->render == nullptr) { exit(-1); /*TODO: create better check*/ }
          |      ^~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:342:3: note: Taking false branch
      342 |   if(row->render == nullptr) { exit(-1); /*TODO: create better check*/ }
          |   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:344:3: note: 'idx' initialized to 0
      344 |   int idx = 0;
          |   ^~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:345:3: note: Loop condition is false. Execution continues on line 354
      345 |   for(int j = 0; j < row->size; j++)
          |   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:355:3: note: The value 0 is assigned to field 'rsize'
      355 |   row->rsize       = idx;
          |   ^~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:357:3: note: Calling 'editorUpdateSyntax'
      357 |   editorUpdateSyntax(row);
          |   ^~~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:141:46: note: Call to 'realloc' has an allocation size of 0 bytes
      141 |   row->hl = reinterpret_cast<unsigned char*>(realloc(row->hl, static_cast<size_t>(row->rsize)));
          |                                              ^                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:141:46: warning: do not manage memory manually; consider std::vector or std::string [cppcoreguidelines-no-malloc,hicpp-no-malloc]
      141 |   row->hl = reinterpret_cast<unsigned char*>(realloc(row->hl, static_cast<size_t>(row->rsize)));
          |                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:141:46: warning: [cppcoreguidelines-owning-memory]

    calling legacy resource function without passing a 'gsl::owner<>'

      141 |   row->hl = reinterpret_cast<unsigned char*>(realloc(row->hl, static_cast<size_t>(row->rsize)));
          |                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:141:46: warning: [misc-include-cleaner]

    no header providing "realloc" is directly included

       27 |   row->hl = reinterpret_cast<unsigned char*>(realloc(row->hl, static_cast<size_t>(row->rsize)));
          |                                              ^

    /examples/kilo.cpp:142:28: warning: [concurrency-mt-unsafe]

    function is not thread safe

      142 |   if(row->hl == nullptr) { exit(-1); /*TODO: better handler*/ }
          |                            ^

    /examples/kilo.cpp:142:28: warning: [misc-include-cleaner]

    no header providing "exit" is directly included

       27 |   if(row->hl == nullptr) { exit(-1); /*TODO: better handler*/ }
          |                            ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:145:23: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      145 |   if(E.syntax.empty()) return;
          |                       ^       
          |                        {

    /examples/kilo.cpp:155:20: warning: [readability-implicit-bool-conversion]

    implicit conversion bool -> 'int'

      155 |   int in_comment = (row->idx > 0) && (E.row[row->idx - 1].hl_open_comment != 0);
          |                    ^                                                           
          |                    static_cast<int>(                                           )

    /examples/kilo.cpp:155:39: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      155 |   int in_comment = (row->idx > 0) && (E.row[row->idx - 1].hl_open_comment != 0);
          |                                       ^

    /examples/kilo.cpp:157:10: warning: [readability-identifier-length]

    variable name 'i' is too short, expected at least 3 characters

      157 |   size_t i = 0;
          |          ^

    /examples/kilo.cpp:158:9: warning: [altera-id-dependent-backward-branch]

    backward branch (while loop) is ID-dependent due to variable reference to 'i' and may cause performance degradation

      158 |   while(i < static_cast<size_t>(row->rsize))
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:157:3: note: inferred assignment of ID-dependent value from ID-dependent variable mce
      157 |   size_t i = 0;
          |   ^

    /examples/kilo.cpp:160:5: warning: [misc-const-correctness]

    variable 'c' of type 'char' can be declared 'const'

      160 |     char          c       = row->render[i];
          |     ^
          |                   const 

    /examples/kilo.cpp:160:19: warning: [readability-identifier-length]

    variable name 'c' is too short, expected at least 3 characters

      160 |     char          c       = row->render[i];
          |                   ^

    /examples/kilo.cpp:160:29: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      160 |     char          c       = row->render[i];
          |                             ^

    /examples/kilo.cpp:161:5: warning: [misc-const-correctness]

    variable 'prev_hl' of type 'unsigned char' can be declared 'const'

      161 |     unsigned char prev_hl = (i > 0) ? row->hl[i - 1] : static_cast<unsigned char>(HL_NORMAL);
          |     ^
          |                   const 

    /examples/kilo.cpp:161:39: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      161 |     unsigned char prev_hl = (i > 0) ? row->hl[i - 1] : static_cast<unsigned char>(HL_NORMAL);
          |                                       ^

    /examples/kilo.cpp:163:8: warning: [readability-container-size-empty]

    the 'empty' method should be used to check for emptiness instead of 'size'

      163 |     if(scs.size() && !in_string && !in_comment)
          |        ^~~~~~~~~~
          |        !scs.empty()
    /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/basic_string.h:1208:7: note: method 'basic_string<char>'::empty() defined here
     1208 |       empty() const _GLIBCXX_NOEXCEPT
          |       ^

    /examples/kilo.cpp:163:8: warning: [readability-implicit-bool-conversion]

    implicit conversion 'size_type' (aka 'unsigned long') -> bool

      163 |     if(scs.size() && !in_string && !in_comment)
          |        ^
          |        (          != 0u)

    /examples/kilo.cpp:163:23: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      163 |     if(scs.size() && !in_string && !in_comment)
          |                      ~^
          |                      (          == 0)

    /examples/kilo.cpp:163:37: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      163 |     if(scs.size() && !in_string && !in_comment)
          |                                    ~^         
          |                                    (           == 0)

    /examples/kilo.cpp:165:11: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      165 |       if(!strncmp(&row->render[i], &scs[0], scs.size()))
          |          ~^                                            
          |                                                         == 0

    /examples/kilo.cpp:165:20: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      165 |       if(!strncmp(&row->render[i], &scs[0], scs.size()))
          |                    ^

    /examples/kilo.cpp:165:36: warning: [readability-container-data-pointer]

    'data' should be used for accessing the data pointer instead of taking the address of the 0-th element

      165 |       if(!strncmp(&row->render[i], &scs[0], scs.size()))
          |                                    ^~~~~~~
          |                                    scs.data()

    /examples/kilo.cpp:167:17: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      167 |         memset(&row->hl[i], HL_COMMENT, row->rsize - i);
          |                 ^

    /examples/kilo.cpp:172:8: warning: [readability-container-size-empty]

    the 'empty' method should be used to check for emptiness instead of 'size'

      172 |     if(mcs.size() && mce.size() && !in_string)
          |        ^~~~~~~~~~
          |        !mcs.empty()
    /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/basic_string.h:1208:7: note: method 'basic_string<char>'::empty() defined here
     1208 |       empty() const _GLIBCXX_NOEXCEPT
          |       ^

    /examples/kilo.cpp:172:8: warning: [readability-implicit-bool-conversion]

    implicit conversion 'size_type' (aka 'unsigned long') -> bool

      172 |     if(mcs.size() && mce.size() && !in_string)
          |        ^
          |        (          != 0u)

    /examples/kilo.cpp:172:22: warning: [readability-container-size-empty]

    the 'empty' method should be used to check for emptiness instead of 'size'

      172 |     if(mcs.size() && mce.size() && !in_string)
          |                      ^~~~~~~~~~
          |                      !mce.empty()
    /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/basic_string.h:1208:7: note: method 'basic_string<char>'::empty() defined here
     1208 |       empty() const _GLIBCXX_NOEXCEPT
          |       ^

    /examples/kilo.cpp:172:22: warning: [readability-implicit-bool-conversion]

    implicit conversion 'size_type' (aka 'unsigned long') -> bool

      172 |     if(mcs.size() && mce.size() && !in_string)
          |                      ^
          |                      (          != 0u)

    /examples/kilo.cpp:172:37: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      172 |     if(mcs.size() && mce.size() && !in_string)
          |                                    ~^        
          |                                    (          == 0)

    /examples/kilo.cpp:174:10: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      174 |       if(in_comment)
          |          ^         
          |                     != 0

    /examples/kilo.cpp:176:9: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      176 |         row->hl[i] = HL_MLCOMMENT;
          |         ^

    /examples/kilo.cpp:177:13: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      177 |         if(!strncmp(&row->render[i], &mce[0], mce.size()))
          |            ~^                                            
          |                                                           == 0

    /examples/kilo.cpp:177:22: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      177 |         if(!strncmp(&row->render[i], &mce[0], mce.size()))
          |                      ^

    /examples/kilo.cpp:177:38: warning: [readability-container-data-pointer]

    'data' should be used for accessing the data pointer instead of taking the address of the 0-th element

      177 |         if(!strncmp(&row->render[i], &mce[0], mce.size()))
          |                                      ^~~~~~~
          |                                      mce.data()

    /examples/kilo.cpp:179:19: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      179 |           memset(&row->hl[i], HL_MLCOMMENT, mce.size());
          |                   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:185:9: warning: do not use 'else' after 'continue' [llvm-else-after-return,readability-else-after-return]
      185 |         else
          |         ^~~~
      186 |         {
          |         ~
      187 |           i++;
          |           ~~~~
      188 |           continue;
          |           ~~~~~~~~~
      189 |         }
          |         ~

    /examples/kilo.cpp:191:16: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      191 |       else if(!strncmp(&row->render[i], &mcs[0], mcs.size()))
          |               ~^                                            
          |                                                              == 0

    /examples/kilo.cpp:191:25: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      191 |       else if(!strncmp(&row->render[i], &mcs[0], mcs.size()))
          |                         ^

    /examples/kilo.cpp:191:41: warning: [readability-container-data-pointer]

    'data' should be used for accessing the data pointer instead of taking the address of the 0-th element

      191 |       else if(!strncmp(&row->render[i], &mcs[0], mcs.size()))
          |                                         ^~~~~~~
          |                                         mcs.data()

    /examples/kilo.cpp:193:17: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      193 |         memset(&row->hl[i], HL_MLCOMMENT, mcs.size());
          |                 ^

    /examples/kilo.cpp:200:8: warning: [readability-implicit-bool-conversion]

    implicit conversion 'std::size_t' (aka 'unsigned long') -> bool

      200 |     if(E.syntax.flags & HL_HIGHLIGHT_STRINGS)
          |        ^                                    
          |        (                                    ) != 0u

    /examples/kilo.cpp:200:25: warning: [hicpp-signed-bitwise]

    use of a signed integer operand with a binary bitwise operator

      200 |     if(E.syntax.flags & HL_HIGHLIGHT_STRINGS)
          |                       ~ ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:53:30: note: expanded from macro 'HL_HIGHLIGHT_STRINGS'
       53 | #define HL_HIGHLIGHT_STRINGS (1 << 1)
          |                              ^~~~~~~~

    /examples/kilo.cpp:202:10: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      202 |       if(in_string)
          |          ^        
          |                    != 0

    /examples/kilo.cpp:204:9: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      204 |         row->hl[i] = HL_STRING;
          |         ^

    /examples/kilo.cpp:207:11: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      207 |           row->hl[i + 1] = HL_STRING;
          |           ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:211:27: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      211 |         if(c == in_string) in_string = 0;
          |                           ^              
          |                            {
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:216:7: warning: do not use 'else' after 'continue' [llvm-else-after-return,readability-else-after-return]
      216 |       else
          |       ^~~~
      217 |       {
          |       ~
      218 |         if(c == '"' || c == '\'')
          |         ~~~~~~~~~~~~~~~~~~~~~~~~~
      219 |         {
          |         ~
      220 |           in_string  = c;
          |           ~~~~~~~~~~~~~~~
      221 |           row->hl[i] = HL_STRING;
          |           ~~~~~~~~~~~~~~~~~~~~~~~
      222 |           i++;
          |           ~~~~
      223 |           continue;
          |           ~~~~~~~~~
      224 |         }
          |         ~
      225 |       }
          |       ~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:220:24: warning: 'signed char' to 'int' conversion; consider casting to 'unsigned char' first. [bugprone-signed-char-misuse,cert-str34-c]
      220 |           in_string  = c;
          |                        ^

    /examples/kilo.cpp:221:11: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      221 |           row->hl[i] = HL_STRING;
          |           ^

    /examples/kilo.cpp:228:8: warning: [readability-implicit-bool-conversion]

    implicit conversion 'std::size_t' (aka 'unsigned long') -> bool

      228 |     if(E.syntax.flags & HL_HIGHLIGHT_NUMBERS)
          |        ^                                    
          |        (                                    ) != 0u

    /examples/kilo.cpp:228:25: warning: [hicpp-signed-bitwise]

    use of a signed integer operand with a binary bitwise operator

      228 |     if(E.syntax.flags & HL_HIGHLIGHT_NUMBERS)
          |                       ~ ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:52:30: note: expanded from macro 'HL_HIGHLIGHT_NUMBERS'
       52 | #define HL_HIGHLIGHT_NUMBERS (1 << 0)
          |                              ^~~~~~~~

    /examples/kilo.cpp:230:11: warning: [misc-include-cleaner]

    no header providing "isdigit" is directly included

       25 |       if((isdigit(c) && (prev_sep || prev_hl == HL_NUMBER)) || (c == '.' && prev_hl == HL_NUMBER))
          |           ^

    /examples/kilo.cpp:230:11: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      230 |       if((isdigit(c) && (prev_sep || prev_hl == HL_NUMBER)) || (c == '.' && prev_hl == HL_NUMBER))
          |           ^
          |           (          != 0)

    /examples/kilo.cpp:230:26: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      230 |       if((isdigit(c) && (prev_sep || prev_hl == HL_NUMBER)) || (c == '.' && prev_hl == HL_NUMBER))
          |                          ^
          |                          (        != 0)

    /examples/kilo.cpp:232:9: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      232 |         row->hl[i] = HL_NUMBER;
          |         ^

    /examples/kilo.cpp:239:8: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      239 |     if(prev_sep)
          |        ^       
          |                 != 0

    /examples/kilo.cpp:241:11: warning: [cppcoreguidelines-init-variables]

    variable 'j' is not initialized

      241 |       int j;
          |           ^
          |             = 0

    /examples/kilo.cpp:241:11: warning: [readability-identifier-length]

    variable name 'j' is too short, expected at least 3 characters

    /examples/kilo.cpp:242:18: warning: [altera-id-dependent-backward-branch]

    backward branch (for loop) is ID-dependent due to variable reference to 'keywords' and may cause performance degradation

      242 |       for(j = 0; keywords[j]; j++)
          |                  ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:147:3: note: inferred assignment of ID-dependent value from ID-dependent member keywords
      147 |   const char** keywords = E.syntax.keywords;
          |   ^

    /examples/kilo.cpp:242:18: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      242 |       for(j = 0; keywords[j]; j++)
          |                  ^

    /examples/kilo.cpp:242:18: warning: [readability-implicit-bool-conversion]

    implicit conversion 'const char *' -> bool

      242 |       for(j = 0; keywords[j]; j++)
          |                  ^          
          |                              != nullptr

    /examples/kilo.cpp:244:44: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      244 |         int klen = static_cast<int>(strlen(keywords[j]));
          |                                            ^

    /examples/kilo.cpp:245:9: warning: [misc-const-correctness]

    variable 'kw2' of type 'int' can be declared 'const'

      245 |         int kw2  = keywords[j][klen - 1] == '|';
          |         ^
          |             const 

    /examples/kilo.cpp:245:20: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      245 |         int kw2  = keywords[j][klen - 1] == '|';
          |                    ^

    /examples/kilo.cpp:245:20: warning: [readability-implicit-bool-conversion]

    implicit conversion bool -> 'int'

      245 |         int kw2  = keywords[j][klen - 1] == '|';
          |                    ^                           
          |                    static_cast<int>(           )

    /examples/kilo.cpp:246:12: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      246 |         if(kw2) klen--;
          |            ^  
          |                != 0
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:246:16: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      246 |         if(kw2) klen--;
          |                ^       
          |                 {

    /examples/kilo.cpp:248:13: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      248 |         if(!strncmp(&row->render[i], keywords[j], klen) && is_separator(row->render[i + klen]))
          |            ~^
          |            (                                            == 0)

    /examples/kilo.cpp:248:22: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      248 |         if(!strncmp(&row->render[i], keywords[j], klen) && is_separator(row->render[i + klen]))
          |                      ^

    /examples/kilo.cpp:248:38: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      248 |         if(!strncmp(&row->render[i], keywords[j], klen) && is_separator(row->render[i + klen]))
          |                                      ^

    /examples/kilo.cpp:248:73: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      248 |         if(!strncmp(&row->render[i], keywords[j], klen) && is_separator(row->render[i + klen]))
          |                                                                         ^

    /examples/kilo.cpp:250:19: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      250 |           memset(&row->hl[i], kw2 ? HL_KEYWORD2 : HL_KEYWORD1, static_cast<size_t>(klen));
          |                   ^

    /examples/kilo.cpp:250:31: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      250 |           memset(&row->hl[i], kw2 ? HL_KEYWORD2 : HL_KEYWORD1, static_cast<size_t>(klen));
          |                               ^
          |                                   != 0

    /examples/kilo.cpp:255:10: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      255 |       if(keywords[j] != nullptr)
          |          ^

    /examples/kilo.cpp:262:16: warning: [readability-implicit-bool-conversion]

    implicit conversion bool -> 'int'

      262 |     prev_sep = is_separator(c);
          |                ^              
          |                static_cast<int>( )

    /examples/kilo.cpp:266:3: warning: [misc-const-correctness]

    variable 'changed' of type 'int' can be declared 'const'

      266 |   int changed          = (row->hl_open_comment != in_comment);
          |   ^
          |       const 

    /examples/kilo.cpp:266:26: warning: [readability-implicit-bool-conversion]

    implicit conversion bool -> 'int'

      266 |   int changed          = (row->hl_open_comment != in_comment);
          |                          ^
          |                          static_cast<int>

    /examples/kilo.cpp:268:6: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      268 |   if(changed && row->idx + 1 < E.numrows) editorUpdateSyntax(&E.row[row->idx + 1]);
          |      ^
          |      (       != 0)

    /examples/kilo.cpp:268:30: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long')

      268 |   if(changed && row->idx + 1 < E.numrows) editorUpdateSyntax(&E.row[row->idx + 1]);
          |                 ~~~~~~~~~~~~ ^ ~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:268:42: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      268 |   if(changed && row->idx + 1 < E.numrows) editorUpdateSyntax(&E.row[row->idx + 1]);
          |                                          ^                                         
          |                                           {

    /examples/kilo.cpp:268:63: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      268 |   if(changed && row->idx + 1 < E.numrows) editorUpdateSyntax(&E.row[row->idx + 1]);
          |                                                               ^

    /examples/kilo.cpp:293:3: warning: [modernize-loop-convert]

    use range-based for loop instead

      293 |   for(std::size_t j = 0; j != HLDB.size(); ++j)
          |   ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          |      (auto & j : HLDB)
      294 |   {
      295 |     for(std::size_t i = 0; i != HLDB[j].filematch.size(); ++i)
          |                                 ~~~~~~~
          |                                 j
      296 |     {
      297 |       if(HLDB[j].filematch[i] == ext)
          |          ~~~~~~~
          |          j
      298 |       {
      299 |         E.syntax = HLDB[j];
          |                    ~~~~~~~
          |                    j

    /examples/kilo.cpp:295:33: warning: [cppcoreguidelines-pro-bounds-constant-array-index]

    do not use array subscript when the index is not an integer constant expression

      295 |     for(std::size_t i = 0; i != HLDB[j].filematch.size(); ++i)
          |                                 ^

    /examples/kilo.cpp:297:10: warning: [cppcoreguidelines-pro-bounds-constant-array-index]

    do not use array subscript when the index is not an integer constant expression

      297 |       if(HLDB[j].filematch[i] == ext)
          |          ^

    /examples/kilo.cpp:299:20: warning: [cppcoreguidelines-pro-bounds-constant-array-index]

    do not use array subscript when the index is not an integer constant expression

      299 |         E.syntax = HLDB[j];
          |                    ^

    /examples/kilo.cpp:300:92: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      300 |         for(std::size_t filerow = 0; filerow < E.numrows; filerow++) { editorUpdateSyntax(&E.row[filerow]); }
          |                                                                                            ^

    /examples/kilo.cpp:309:36: warning: [readability-identifier-length]

    parameter name 'cx' is too short, expected at least 3 characters

      309 | int editorRowCxToRx(erow* row, int cx)
          |                                    ^

    /examples/kilo.cpp:311:7: warning: [readability-identifier-length]

    variable name 'rx' is too short, expected at least 3 characters

      311 |   int rx = 0;
          |       ^

    /examples/kilo.cpp:312:28: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'std::size_t' (aka 'unsigned long') and 'int'

      312 |   for(std::size_t j = 0; j < cx; ++j)
          |                          ~ ^ ~~

    /examples/kilo.cpp:314:8: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      314 |     if(row->chars[j] == '\t') { rx += (KILO_TAB_STOP - 1) - (rx % KILO_TAB_STOP); }
          |        ^

    /examples/kilo.cpp:320:36: warning: [readability-identifier-length]

    parameter name 'rx' is too short, expected at least 3 characters

      320 | int editorRowRxToCx(erow* row, int rx)
          |                                    ^

    /examples/kilo.cpp:323:7: warning: [readability-identifier-length]

    variable name 'cx' is too short, expected at least 3 characters

      323 |   int cx{};
          |       ^

    /examples/kilo.cpp:326:8: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      326 |     if(row->chars[cx] == '\t') cur_rx += (KILO_TAB_STOP - 1) - (cur_rx % KILO_TAB_STOP);
          |        ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:326:31: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      326 |     if(row->chars[cx] == '\t') cur_rx += (KILO_TAB_STOP - 1) - (cur_rx % KILO_TAB_STOP);
          |                               ^                                                         
          |                                {
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:329:20: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      329 |     if(cur_rx > rx) return cx;
          |                    ^          
          |                     {
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:337:37: warning: statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
      337 |   for(int j = 0; j < row->size; j++)
          |                                     ^
          |                                      {
      338 |     if(row->chars[j] == '\t') tabs++;
          |                                      

    /examples/kilo.cpp:338:8: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      338 |     if(row->chars[j] == '\t') tabs++;
          |        ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:338:30: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      338 |     if(row->chars[j] == '\t') tabs++;
          |                              ^       
          |                               {
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:340:3: warning: do not manage memory manually; use RAII [cppcoreguidelines-no-malloc,hicpp-no-malloc]
      340 |   free(row->render);
          |   ^~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:340:3: warning: [cppcoreguidelines-owning-memory]

    calling legacy resource function without passing a 'gsl::owner<>'

      340 |   free(row->render);
          |   ^~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:340:3: warning: [misc-include-cleaner]

    no header providing "free" is directly included

       27 |   free(row->render);
          |   ^

    /examples/kilo.cpp:341:3: warning: [cppcoreguidelines-owning-memory]

    assigning newly created 'gsl::owner<>' to non-owner 'char *'

      341 |   row->render = reinterpret_cast<char*>(malloc(static_cast<size_t>(row->size + tabs * (KILO_TAB_STOP - 1) + 1)));
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:341:17: warning: [cppcoreguidelines-pro-type-reinterpret-cast]

    do not use reinterpret_cast

      341 |   row->render = reinterpret_cast<char*>(malloc(static_cast<size_t>(row->size + tabs * (KILO_TAB_STOP - 1) + 1)));
          |                 ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:341:41: warning: do not manage memory manually; consider a container or a smart pointer [cppcoreguidelines-no-malloc,hicpp-no-malloc]
      341 |   row->render = reinterpret_cast<char*>(malloc(static_cast<size_t>(row->size + tabs * (KILO_TAB_STOP - 1) + 1)));
          |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:341:41: warning: [misc-include-cleaner]

    no header providing "malloc" is directly included

       27 |   row->render = reinterpret_cast<char*>(malloc(static_cast<size_t>(row->size + tabs * (KILO_TAB_STOP - 1) + 1)));
          |                                         ^

    /examples/kilo.cpp:341:48: warning: [bugprone-misplaced-widening-cast]

    either cast from 'int' to 'size_t' (aka 'unsigned long') is ineffective, or there is loss of precision before the conversion

      341 |   row->render = reinterpret_cast<char*>(malloc(static_cast<size_t>(row->size + tabs * (KILO_TAB_STOP - 1) + 1)));
          |                                                ^

    /examples/kilo.cpp:342:32: warning: [concurrency-mt-unsafe]

    function is not thread safe

      342 |   if(row->render == nullptr) { exit(-1); /*TODO: create better check*/ }
          |                                ^

    /examples/kilo.cpp:342:32: warning: [misc-include-cleaner]

    no header providing "exit" is directly included

       27 |   if(row->render == nullptr) { exit(-1); /*TODO: create better check*/ }
          |                                ^

    /examples/kilo.cpp:347:8: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      347 |     if(row->chars[j] == '\t')
          |        ^

    /examples/kilo.cpp:349:7: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      349 |       row->render[idx++] = ' ';
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:350:38: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      350 |       while(idx % KILO_TAB_STOP != 0) row->render[idx++] = ' ';
          |                                      ^                         
          |                                       {

    /examples/kilo.cpp:350:39: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      350 |       while(idx % KILO_TAB_STOP != 0) row->render[idx++] = ' ';
          |                                       ^

    /examples/kilo.cpp:352:12: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      352 |     else { row->render[idx++] = row->chars[j]; }
          |            ^

    /examples/kilo.cpp:352:33: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      352 |     else { row->render[idx++] = row->chars[j]; }
          |                                 ^

    /examples/kilo.cpp:354:3: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      354 |   row->render[idx] = '\0';
          |   ^

    /examples/kilo.cpp:360:26: warning: [readability-identifier-length]

    parameter name 'at' is too short, expected at least 3 characters

      360 | void editorInsertRow(int at, const char* s, std::size_t len)
          |                          ^

    /examples/kilo.cpp:360:42: warning: [readability-identifier-length]

    parameter name 's' is too short, expected at least 3 characters

      360 | void editorInsertRow(int at, const char* s, std::size_t len)
          |                                          ^

    /examples/kilo.cpp:362:19: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long')

      362 |   if(at < 0 || at > E.numrows) return;
          |                ~~ ^ ~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:362:31: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      362 |   if(at < 0 || at > E.numrows) return;
          |                               ^       
          |                                {

    /examples/kilo.cpp:364:3: warning: [cppcoreguidelines-owning-memory]

    assigning newly created 'gsl::owner<>' to non-owner 'erow *' (aka '(anonymous namespace)::erow *')

      364 |   E.row = reinterpret_cast<erow*>(realloc(E.row, sizeof(erow) * (static_cast<size_t>(E.numrows) + 1)));
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:364:11: warning: [cppcoreguidelines-pro-type-reinterpret-cast]

    do not use reinterpret_cast

      364 |   E.row = reinterpret_cast<erow*>(realloc(E.row, sizeof(erow) * (static_cast<size_t>(E.numrows) + 1)));
          |           ^

    /examples/kilo.cpp:364:35: warning: [bugprone-suspicious-realloc-usage]

    'E.row' may be set to null if 'realloc' fails, which may result in a leak of the original buffer

      364 |   E.row = reinterpret_cast<erow*>(realloc(E.row, sizeof(erow) * (static_cast<size_t>(E.numrows) + 1)));
          |   ~~~~~                           ^       ~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:364:35: warning: do not manage memory manually; consider std::vector or std::string [cppcoreguidelines-no-malloc,hicpp-no-malloc]
      364 |   E.row = reinterpret_cast<erow*>(realloc(E.row, sizeof(erow) * (static_cast<size_t>(E.numrows) + 1)));
          |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:364:35: warning: [cppcoreguidelines-owning-memory]

    calling legacy resource function without passing a 'gsl::owner<>'

      364 |   E.row = reinterpret_cast<erow*>(realloc(E.row, sizeof(erow) * (static_cast<size_t>(E.numrows) + 1)));
          |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:364:35: warning: [misc-include-cleaner]

    no header providing "realloc" is directly included

       27 |   E.row = reinterpret_cast<erow*>(realloc(E.row, sizeof(erow) * (static_cast<size_t>(E.numrows) + 1)));
          |                                   ^

    /examples/kilo.cpp:365:26: warning: [concurrency-mt-unsafe]

    function is not thread safe

      365 |   if(E.row == nullptr) { exit(-1); /*TODO: create better check*/ }
          |                          ^

    /examples/kilo.cpp:365:26: warning: [misc-include-cleaner]

    no header providing "exit" is directly included

       27 |   if(E.row == nullptr) { exit(-1); /*TODO: create better check*/ }
          |                          ^

    /examples/kilo.cpp:366:12: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      366 |   memmove(&E.row[at + 1], &E.row[at], sizeof(erow) * (static_cast<size_t>(E.numrows) - at));
          |            ^

    /examples/kilo.cpp:366:28: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      366 |   memmove(&E.row[at + 1], &E.row[at], sizeof(erow) * (static_cast<size_t>(E.numrows) - at));
          |                            ^

    /examples/kilo.cpp:367:23: warning: [altera-id-dependent-backward-branch]

    backward branch (for loop) is ID-dependent due to variable reference to 'j' and may cause performance degradation

      367 |   for(int j = at + 1; j <= E.numrows; j++) E.row[j].idx++;
          |                       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:367:7: note: inferred assignment of ID-dependent value from ID-dependent 
      367 |   for(int j = at + 1; j <= E.numrows; j++) E.row[j].idx++;
          |       ^

    /examples/kilo.cpp:367:25: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long')

      367 |   for(int j = at + 1; j <= E.numrows; j++) E.row[j].idx++;
          |                       ~ ^  ~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:367:43: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      367 |   for(int j = at + 1; j <= E.numrows; j++) E.row[j].idx++;
          |                                           ^               
          |                                            {

    /examples/kilo.cpp:367:44: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      367 |   for(int j = at + 1; j <= E.numrows; j++) E.row[j].idx++;
          |                                            ^

    /examples/kilo.cpp:369:3: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      369 |   E.row[at].idx = at;
          |   ^

    /examples/kilo.cpp:371:3: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      371 |   E.row[at].size  = static_cast<int>(len);
          |   ^

    /examples/kilo.cpp:372:3: warning: [cppcoreguidelines-owning-memory]

    assigning newly created 'gsl::owner<>' to non-owner 'char *'

      372 |   E.row[at].chars = (char*)malloc(len + 1);
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:372:3: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

    /examples/kilo.cpp:372:21: warning: [cppcoreguidelines-pro-type-cstyle-cast]

    do not use C-style cast to convert between unrelated types

      372 |   E.row[at].chars = (char*)malloc(len + 1);
          |                     ^

    /examples/kilo.cpp:372:21: warning: [google-readability-casting]

    C-style casts are discouraged; use static_cast

      372 |   E.row[at].chars = (char*)malloc(len + 1);
          |                     ^~~~~~~               
          |                     static_cast<char*>(   )
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:372:28: warning: do not manage memory manually; consider a container or a smart pointer [cppcoreguidelines-no-malloc,hicpp-no-malloc]
      372 |   E.row[at].chars = (char*)malloc(len + 1);
          |                            ^~~~~~~~~~~~~~~

    /examples/kilo.cpp:372:28: warning: [misc-include-cleaner]

    no header providing "malloc" is directly included

       27 |   E.row[at].chars = (char*)malloc(len + 1);
          |                            ^

    /examples/kilo.cpp:373:6: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      373 |   if(E.row[at].chars == nullptr)
          |      ^

    /examples/kilo.cpp:376:5: warning: [concurrency-mt-unsafe]

    function is not thread safe

      376 |     exit(-1);  // insert better error handling if needed
          |     ^

    /examples/kilo.cpp:376:5: warning: [misc-include-cleaner]

    no header providing "exit" is directly included

       27 |     exit(-1);  // insert better error handling if needed
          |     ^

    /examples/kilo.cpp:378:10: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      378 |   memcpy(E.row[at].chars, s, len);
          |          ^

    /examples/kilo.cpp:379:3: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      379 |   E.row[at].chars[len] = '\0';
          |   ^

    /examples/kilo.cpp:381:3: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      381 |   E.row[at].rsize           = 0;
          |   ^

    /examples/kilo.cpp:382:3: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      382 |   E.row[at].render          = nullptr;
          |   ^

    /examples/kilo.cpp:383:3: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      383 |   E.row[at].hl              = nullptr;
          |   ^

    /examples/kilo.cpp:384:3: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      384 |   E.row[at].hl_open_comment = 0;
          |   ^

    /examples/kilo.cpp:385:20: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      385 |   editorUpdateRow(&E.row[at]);
          |                    ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:393:3: warning: do not manage memory manually; use RAII [cppcoreguidelines-no-malloc,hicpp-no-malloc]
      393 |   free(row->render);
          |   ^~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:393:3: warning: [cppcoreguidelines-owning-memory]

    calling legacy resource function without passing a 'gsl::owner<>'

      393 |   free(row->render);
          |   ^~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:393:3: warning: [misc-include-cleaner]

    no header providing "free" is directly included

       27 |   free(row->render);
          |   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:394:3: warning: do not manage memory manually; use RAII [cppcoreguidelines-no-malloc,hicpp-no-malloc]
      394 |   free(row->chars);
          |   ^~~~~~~~~~~~~~~~

    /examples/kilo.cpp:394:3: warning: [cppcoreguidelines-owning-memory]

    calling legacy resource function without passing a 'gsl::owner<>'

      394 |   free(row->chars);
          |   ^~~~~~~~~~~~~~~~

    /examples/kilo.cpp:394:3: warning: [misc-include-cleaner]

    no header providing "free" is directly included

       27 |   free(row->chars);
          |   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:395:3: warning: do not manage memory manually; use RAII [cppcoreguidelines-no-malloc,hicpp-no-malloc]
      395 |   free(row->hl);
          |   ^~~~~~~~~~~~~

    /examples/kilo.cpp:395:3: warning: [cppcoreguidelines-owning-memory]

    calling legacy resource function without passing a 'gsl::owner<>'

      395 |   free(row->hl);
          |   ^~~~~~~~~~~~~

    /examples/kilo.cpp:395:3: warning: [misc-include-cleaner]

    no header providing "free" is directly included

       27 |   free(row->hl);
          |   ^

    /examples/kilo.cpp:398:23: warning: [readability-identifier-length]

    parameter name 'at' is too short, expected at least 3 characters

      398 | void editorDelRow(int at)
          |                       ^

    /examples/kilo.cpp:400:19: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long')

      400 |   if(at < 0 || at >= E.numrows) return;
          |                ~~ ^  ~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:400:32: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      400 |   if(at < 0 || at >= E.numrows) return;
          |                                ^       
          |                                 {

    /examples/kilo.cpp:401:18: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      401 |   editorFreeRow(&E.row[at]);
          |                  ^

    /examples/kilo.cpp:402:12: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      402 |   memmove(&E.row[at], &E.row[at + 1], sizeof(erow) * (static_cast<size_t>(E.numrows) - at - 1));
          |            ^

    /examples/kilo.cpp:402:24: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      402 |   memmove(&E.row[at], &E.row[at + 1], sizeof(erow) * (static_cast<size_t>(E.numrows) - at - 1));
          |                        ^

    /examples/kilo.cpp:403:19: warning: [altera-id-dependent-backward-branch]

    backward branch (for loop) is ID-dependent due to variable reference to 'j' and may cause performance degradation

      403 |   for(int j = at; j < E.numrows - 1; j++) E.row[j].idx--;
          |                   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:403:7: note: inferred assignment of ID-dependent value from ID-dependent 
      403 |   for(int j = at; j < E.numrows - 1; j++) E.row[j].idx--;
          |       ^

    /examples/kilo.cpp:403:21: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long')

      403 |   for(int j = at; j < E.numrows - 1; j++) E.row[j].idx--;
          |                   ~ ^ ~~~~~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:403:42: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      403 |   for(int j = at; j < E.numrows - 1; j++) E.row[j].idx--;
          |                                          ^               
          |                                           {

    /examples/kilo.cpp:403:43: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      403 |   for(int j = at; j < E.numrows - 1; j++) E.row[j].idx--;
          |                                           ^

    /examples/kilo.cpp:408:41: warning: [readability-identifier-length]

    parameter name 'at' is too short, expected at least 3 characters

      408 | void editorRowInsertChar(erow* row, int at, int c)
          |                                         ^

    /examples/kilo.cpp:408:49: warning: [readability-identifier-length]

    parameter name 'c' is too short, expected at least 3 characters

      408 | void editorRowInsertChar(erow* row, int at, int c)
          |                                                 ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:410:31: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      410 |   if(at < 0 || at > row->size) at = row->size;
          |                               ^               
          |                                {

    /examples/kilo.cpp:411:3: warning: [cppcoreguidelines-owning-memory]

    assigning newly created 'gsl::owner<>' to non-owner 'char *'

      411 |   row->chars = reinterpret_cast<char*>(realloc(row->chars, static_cast<size_t>(row->size) + 2));
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:411:16: warning: [cppcoreguidelines-pro-type-reinterpret-cast]

    do not use reinterpret_cast

      411 |   row->chars = reinterpret_cast<char*>(realloc(row->chars, static_cast<size_t>(row->size) + 2));
          |                ^

    /examples/kilo.cpp:411:40: warning: [bugprone-suspicious-realloc-usage]

    'row->chars' may be set to null if 'realloc' fails, which may result in a leak of the original buffer

      411 |   row->chars = reinterpret_cast<char*>(realloc(row->chars, static_cast<size_t>(row->size) + 2));
          |   ~~~~~~~~~~                           ^       ~~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:411:40: warning: do not manage memory manually; consider std::vector or std::string [cppcoreguidelines-no-malloc,hicpp-no-malloc]
      411 |   row->chars = reinterpret_cast<char*>(realloc(row->chars, static_cast<size_t>(row->size) + 2));
          |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:411:40: warning: [cppcoreguidelines-owning-memory]

    calling legacy resource function without passing a 'gsl::owner<>'

      411 |   row->chars = reinterpret_cast<char*>(realloc(row->chars, static_cast<size_t>(row->size) + 2));
          |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:411:40: warning: [misc-include-cleaner]

    no header providing "realloc" is directly included

       27 |   row->chars = reinterpret_cast<char*>(realloc(row->chars, static_cast<size_t>(row->size) + 2));
          |                                        ^

    /examples/kilo.cpp:412:31: warning: [concurrency-mt-unsafe]

    function is not thread safe

      412 |   if(row->chars == nullptr) { exit(-1); /*TODO: create better check*/ }
          |                               ^

    /examples/kilo.cpp:412:31: warning: [misc-include-cleaner]

    no header providing "exit" is directly included

       27 |   if(row->chars == nullptr) { exit(-1); /*TODO: create better check*/ }
          |                               ^

    /examples/kilo.cpp:413:12: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      413 |   memmove(&row->chars[at + 1], &row->chars[at], static_cast<size_t>(row->size) - at + 1);
          |            ^

    /examples/kilo.cpp:413:33: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      413 |   memmove(&row->chars[at + 1], &row->chars[at], static_cast<size_t>(row->size) - at + 1);
          |                                 ^

    /examples/kilo.cpp:415:3: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      415 |   row->chars[at] = static_cast<char>(c);
          |   ^

    /examples/kilo.cpp:420:45: warning: [readability-identifier-length]

    parameter name 's' is too short, expected at least 3 characters

      420 | void editorRowAppendString(erow* row, char* s, std::size_t len)
          |                                             ^

    /examples/kilo.cpp:422:3: warning: [cppcoreguidelines-owning-memory]

    assigning newly created 'gsl::owner<>' to non-owner 'char *'

      422 |   row->chars = reinterpret_cast<char*>(realloc(row->chars, static_cast<size_t>(row->size) + len + 1));
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:422:16: warning: [cppcoreguidelines-pro-type-reinterpret-cast]

    do not use reinterpret_cast

      422 |   row->chars = reinterpret_cast<char*>(realloc(row->chars, static_cast<size_t>(row->size) + len + 1));
          |                ^

    /examples/kilo.cpp:422:40: warning: [bugprone-suspicious-realloc-usage]

    'row->chars' may be set to null if 'realloc' fails, which may result in a leak of the original buffer

      422 |   row->chars = reinterpret_cast<char*>(realloc(row->chars, static_cast<size_t>(row->size) + len + 1));
          |   ~~~~~~~~~~                           ^       ~~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:422:40: warning: do not manage memory manually; consider std::vector or std::string [cppcoreguidelines-no-malloc,hicpp-no-malloc]
      422 |   row->chars = reinterpret_cast<char*>(realloc(row->chars, static_cast<size_t>(row->size) + len + 1));
          |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:422:40: warning: [cppcoreguidelines-owning-memory]

    calling legacy resource function without passing a 'gsl::owner<>'

      422 |   row->chars = reinterpret_cast<char*>(realloc(row->chars, static_cast<size_t>(row->size) + len + 1));
          |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:422:40: warning: [misc-include-cleaner]

    no header providing "realloc" is directly included

       27 |   row->chars = reinterpret_cast<char*>(realloc(row->chars, static_cast<size_t>(row->size) + len + 1));
          |                                        ^

    /examples/kilo.cpp:423:31: warning: [concurrency-mt-unsafe]

    function is not thread safe

      423 |   if(row->chars == nullptr) { exit(-1); /*TODO: create better check*/ }
          |                               ^

    /examples/kilo.cpp:423:31: warning: [misc-include-cleaner]

    no header providing "exit" is directly included

       27 |   if(row->chars == nullptr) { exit(-1); /*TODO: create better check*/ }
          |                               ^

    /examples/kilo.cpp:424:11: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      424 |   memcpy(&row->chars[row->size], s, len);
          |           ^

    /examples/kilo.cpp:426:3: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      426 |   row->chars[row->size] = '\0';
          |   ^

    /examples/kilo.cpp:431:38: warning: [readability-identifier-length]

    parameter name 'at' is too short, expected at least 3 characters

      431 | void editorRowDelChar(erow* row, int at)
          |                                      ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:433:32: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      433 |   if(at < 0 || at >= row->size) return;
          |                                ^       
          |                                 {

    /examples/kilo.cpp:434:12: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      434 |   memmove(&row->chars[at], &row->chars[at + 1], static_cast<size_t>(row->size) - at);
          |            ^

    /examples/kilo.cpp:434:29: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      434 |   memmove(&row->chars[at], &row->chars[at + 1], static_cast<size_t>(row->size) - at);
          |                             ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:444:43: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      444 |   if(E.cy == E.numrows) { editorInsertRow(E.numrows, "", 0); }
          |                                           ^

    /examples/kilo.cpp:445:24: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      445 |   editorRowInsertChar(&E.row[E.cy], E.cx, key);
          |                        ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:445:37: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      445 |   editorRowInsertChar(&E.row[E.cy], E.cx, key);
          |                                     ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:451:35: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      451 |   if(E.cx == 0) { editorInsertRow(E.cy, "", 0); }
          |                                   ^

    /examples/kilo.cpp:454:18: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      454 |     erow* row = &E.row[E.cy];
          |                  ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:455:21: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      455 |     editorInsertRow(E.cy + 1, &row->chars[E.cx], static_cast<size_t>(row->size - E.cx));
          |                     ^

    /examples/kilo.cpp:455:32: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      455 |     editorInsertRow(E.cy + 1, &row->chars[E.cx], static_cast<size_t>(row->size - E.cx));
          |                                ^

    /examples/kilo.cpp:456:30: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      456 |     row                   = &E.row[E.cy];
          |                              ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:457:29: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      457 |     row->size             = E.cx;
          |                             ^

    /examples/kilo.cpp:458:5: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      458 |     row->chars[row->size] = '\0';
          |     ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:467:24: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      467 |   if(E.cy == E.numrows) return;
          |                        ^       
          |                         {
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:468:29: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      468 |   if(E.cx == 0 && E.cy == 0) return;
          |                             ^       
          |                              {

    /examples/kilo.cpp:470:16: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      470 |   erow* row = &E.row[E.cy];
          |                ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:473:27: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      473 |     editorRowDelChar(row, E.cx - 1);
          |                           ^

    /examples/kilo.cpp:478:12: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      478 |     E.cx = E.row[E.cy - 1].size;
          |            ^

    /examples/kilo.cpp:479:28: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      479 |     editorRowAppendString(&E.row[E.cy - 1], row->chars, static_cast<size_t>(row->size));
          |                            ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:480:18: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      480 |     editorDelRow(E.cy);
          |                  ^

    /examples/kilo.cpp:490:76: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      490 |   for(std::size_t line = 0; line < E.numrows; ++line) { ret += std::string(E.row[line].chars, static_cast<std::size_t>(E.row[line].size)) + '\n'; }
          |                                                                            ^

    /examples/kilo.cpp:490:120: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      490 |   for(std::size_t line = 0; line < E.numrows; ++line) { ret += std::string(E.row[line].chars, static_cast<std::size_t>(E.row[line].size)) + '\n'; }
          |                                                                                                                        ^

    /examples/kilo.cpp:500:32: warning: [misc-include-cleaner]

    no header providing "std::runtime_error" is directly included

       30 |   if(file.fail()) { throw std::runtime_error("File failed to open."); }
          |                                ^

    /examples/kilo.cpp:503:9: warning: [altera-id-dependent-backward-branch]

    backward branch (while loop) is ID-dependent due to variable reference to 'file' and may cause performance degradation

      503 |   while(file.rdstate() == std::ios_base::goodbit)
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:499:3: note: inferred assignment of ID-dependent value from ID-dependent 
      499 |   std::ifstream file(E.filename);
          |   ^

    /examples/kilo.cpp:505:5: warning: [google-runtime-int]

    consider replacing 'long' with 'int64'

      505 |     long linelen = static_cast<long>(line.size());
          |     ^

    /examples/kilo.cpp:505:32: warning: [google-runtime-int]

    consider replacing 'long' with 'int64'

      505 |     long linelen = static_cast<long>(line.size());
          |                                ^

    /examples/kilo.cpp:506:11: warning: [altera-id-dependent-backward-branch]

    backward branch (while loop) is ID-dependent due to variable reference to 'linelen' and may cause performance degradation

      506 |     while(linelen > 0 && (line[static_cast<size_t>(linelen - 1)] == '\n' || line[static_cast<size_t>(linelen - 1)] == '\r')) linelen--;
          |           ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:505:5: note: inferred assignment of ID-dependent value from ID-dependent 
      505 |     long linelen = static_cast<long>(line.size());
          |     ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:506:125: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      506 |     while(linelen > 0 && (line[static_cast<size_t>(linelen - 1)] == '\n' || line[static_cast<size_t>(linelen - 1)] == '\r')) linelen--;
          |                                                                                                                             ^          
          |                                                                                                                              {
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:507:21: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      507 |     editorInsertRow(E.numrows, line.c_str(), linelen);
          |                     ^

    /examples/kilo.cpp:513:6: warning: [cert-dcl50-cpp]

    do not define a C-style variadic function; consider using a function parameter pack or currying instead

      513 | void editorSetStatusMessage(const std::string fmt, ...)
          |      ^

    /examples/kilo.cpp:513:47: warning: [performance-unnecessary-value-param]

    the const qualified parameter 'fmt' is copied for each invocation; consider making it a reference

      513 | void editorSetStatusMessage(const std::string fmt, ...)
          |                                               ^
          |                                              &
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:515:3: warning: do not declare variables of type va_list; use variadic templates instead [cppcoreguidelines-pro-type-vararg,hicpp-vararg]
      515 |   va_list ap;
          |   ^

    /examples/kilo.cpp:515:11: warning: [readability-identifier-length]

    variable name 'ap' is too short, expected at least 3 characters

      515 |   va_list ap;
          |           ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:516:12: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
      516 |   va_start(ap, fmt);
          |            ^

    /examples/kilo.cpp:517:3: warning: [cert-err33-c]

    the value returned by this function should be used

      517 |   vsnprintf(&E.statusmsg[0], E.statusmsg.capacity(), fmt.c_str(), ap);
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:517:3: note: cast the expression to void to silence this warning

    /examples/kilo.cpp:517:3: warning: [misc-include-cleaner]

    no header providing "vsnprintf" is directly included

       27 |   vsnprintf(&E.statusmsg[0], E.statusmsg.capacity(), fmt.c_str(), ap);
          |   ^

    /examples/kilo.cpp:517:13: warning: [readability-container-data-pointer]

    'data' should be used for accessing the data pointer instead of taking the address of the 0-th element

      517 |   vsnprintf(&E.statusmsg[0], E.statusmsg.capacity(), fmt.c_str(), ap);
          |             ^~~~~~~~~~~~~~~
          |             E.statusmsg.data()
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:517:67: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
      517 |   vsnprintf(&E.statusmsg[0], E.statusmsg.capacity(), fmt.c_str(), ap);
          |                                                                   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:518:10: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
      518 |   va_end(ap);
          |          ^

    /examples/kilo.cpp:519:22: warning: [misc-include-cleaner]

    no header providing "time" is directly included

       28 |   E.statusmsg_time = time(nullptr);
          |                      ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:529:7: warning: do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg,hicpp-vararg]
      529 |       editorSetStatusMessage("Save aborted");
          |       ^

    /examples/kilo.cpp:535:3: warning: [misc-const-correctness]

    variable 'text' of type 'std::string' (aka 'basic_string') can be declared 'const'

      535 |   std::string   text = editorRowsToString();
          |   ^
          |                 const 
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:541:3: warning: do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg,hicpp-vararg]
      541 |   editorSetStatusMessage("%d bytes written to disk", text.size());
          |   ^

    /examples/kilo.cpp:554:6: warning: [readability-implicit-bool-conversion]

    implicit conversion 'char *' -> bool

      554 |   if(saved_hl)
          |      ^       
          |               != nullptr

    /examples/kilo.cpp:556:12: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      556 |     memcpy(E.row[saved_hl_line].hl, saved_hl, static_cast<size_t>(E.row[saved_hl_line].rsize));
          |            ^

    /examples/kilo.cpp:556:67: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      556 |     memcpy(E.row[saved_hl_line].hl, saved_hl, static_cast<size_t>(E.row[saved_hl_line].rsize));
          |                                                                   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:557:5: warning: do not manage memory manually; use RAII [cppcoreguidelines-no-malloc,hicpp-no-malloc]
      557 |     free(saved_hl);
          |     ^~~~~~~~~~~~~~

    /examples/kilo.cpp:557:5: warning: [cppcoreguidelines-owning-memory]

    calling legacy resource function without passing a 'gsl::owner<>'

      557 |     free(saved_hl);
          |     ^~~~~~~~~~~~~~

    /examples/kilo.cpp:557:5: warning: [misc-include-cleaner]

    no header providing "free" is directly included

       27 |     free(saved_hl);
          |     ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:567:3: warning: do not use 'else' after 'return' [llvm-else-after-return,readability-else-after-return]
      567 |   else if(key == Term::Key::ArrowRight || key == Term::Key::ArrowDown) { direction = 1; }
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      568 |   else if(key == Term::Key::ArrowLeft || key == Term::Key::ArrowUp) { direction = -1; }
          |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      569 |   else
          |   ~~~~
      570 |   {
          |   ~
      571 |     last_match = -1;
          |     ~~~~~~~~~~~~~~~~
      572 |     direction  = 1;
          |     ~~~~~~~~~~~~~~~
      573 |   }
          |   ~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:575:23: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      575 |   if(last_match == -1) direction = 1;
          |                       ^              
          |                        {

    /examples/kilo.cpp:577:20: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long')

      577 |   for(int i = 0; i < E.numrows; i++)
          |                  ~ ^ ~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:580:35: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      580 |     if(current == -1) { current = E.numrows - 1; }
          |                                   ^

    /examples/kilo.cpp:581:21: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long')

      581 |     else if(current == E.numrows) { current = 0; }
          |             ~~~~~~~ ^  ~~~~~~~~~

    /examples/kilo.cpp:583:20: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      583 |     erow* row   = &E.row[current];
          |                    ^

    /examples/kilo.cpp:585:8: warning: [readability-implicit-bool-conversion]

    implicit conversion 'char *' -> bool

      585 |     if(match)
          |        ^    
          |              != nullptr

    /examples/kilo.cpp:593:7: warning: [cppcoreguidelines-owning-memory]

    assigning newly created 'gsl::owner<>' to non-owner 'char *'

      593 |       saved_hl      = reinterpret_cast<char*>(malloc(static_cast<size_t>(row->rsize)));
          |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:593:23: warning: [cppcoreguidelines-pro-type-reinterpret-cast]

    do not use reinterpret_cast

      593 |       saved_hl      = reinterpret_cast<char*>(malloc(static_cast<size_t>(row->rsize)));
          |                       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:593:47: warning: do not manage memory manually; consider a container or a smart pointer [cppcoreguidelines-no-malloc,hicpp-no-malloc]
      593 |       saved_hl      = reinterpret_cast<char*>(malloc(static_cast<size_t>(row->rsize)));
          |                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:593:47: warning: [misc-include-cleaner]

    no header providing "malloc" is directly included

       27 |       saved_hl      = reinterpret_cast<char*>(malloc(static_cast<size_t>(row->rsize)));
          |                                               ^

    /examples/kilo.cpp:594:33: warning: [concurrency-mt-unsafe]

    function is not thread safe

      594 |       if(saved_hl == nullptr) { exit(-1); /*TODO: better handler*/ }
          |                                 ^

    /examples/kilo.cpp:594:33: warning: [misc-include-cleaner]

    no header providing "exit" is directly included

       27 |       if(saved_hl == nullptr) { exit(-1); /*TODO: better handler*/ }
          |                                 ^

    /examples/kilo.cpp:596:15: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      596 |       memset(&row->hl[match - row->render], HL_MATCH, query.size());
          |               ^

    /examples/kilo.cpp:609:3: warning: [misc-const-correctness]

    variable 'query' of type 'std::string' (aka 'basic_string') can be declared 'const'

      609 |   std::string query = editorPrompt("Search: %s (Use ESC/Arrows/Enter)", editorFindCallback);
          |   ^
          |               const 

    /examples/kilo.cpp:625:50: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      625 |   if(E.cy < E.numrows) { E.rx = editorRowCxToRx(&E.row[E.cy], E.cx); }
          |                                                  ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:625:63: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      625 |   if(E.cy < E.numrows) { E.rx = editorRowCxToRx(&E.row[E.cy], E.cx); }
          |                                                               ^

    /examples/kilo.cpp:629:11: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long')

      629 |   if(E.rx < E.coloff) { E.coloff = E.rx; }
          |      ~~~~ ^ ~~~~~~~~

    /examples/kilo.cpp:630:11: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long')

      630 |   if(E.rx >= E.coloff + E.screencols) { E.coloff = E.rx - E.screencols + 1; }
          |      ~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:633:6: warning: [readability-function-cognitive-complexity]

    function 'editorDrawRows' has cognitive complexity of 56 (threshold 25)

      633 | void editorDrawRows(std::string& screen)
          |      ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:635:3: note: +1, including nesting penalty of 0, nesting level increased to 1
      635 |   for(int y = 0; y < E.screenrows; y++)
          |   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:638:5: note: +2, including nesting penalty of 1, nesting level increased to 2
      638 |     if(filerow >= E.numrows)
          |     ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:640:7: note: +3, including nesting penalty of 2, nesting level increased to 3
      640 |       if(E.numrows == 0 && y == E.screenrows / 3)
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:640:25: note: +1
      640 |       if(E.numrows == 0 && y == E.screenrows / 3)
          |                         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:644:9: note: +4, including nesting penalty of 3, nesting level increased to 4
      644 |         if(welcomelen > E.screencols) welcomelen = E.screencols;
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:646:9: note: +4, including nesting penalty of 3, nesting level increased to 4
      646 |         if(padding)
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:651:9: note: +4, including nesting penalty of 3, nesting level increased to 4
      651 |         while(padding--) screen.append(" ");
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:654:7: note: +1, nesting level increased to 3
      654 |       else { screen.append("~"); }
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:656:5: note: +1, nesting level increased to 2
      656 |     else
          |     ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:659:7: note: +3, including nesting penalty of 2, nesting level increased to 3
      659 |       if(len < 0) len = 0;
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:660:7: note: +3, including nesting penalty of 2, nesting level increased to 3
      660 |       if(len > E.screencols) len = E.screencols;
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:665:7: note: +3, including nesting penalty of 2, nesting level increased to 3
      665 |       for(j = 0; j < len; j++)
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:667:9: note: +4, including nesting penalty of 3, nesting level increased to 4
      667 |         if(iscntrl(c[j]))
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:669:35: note: +5, including nesting penalty of 4, nesting level increased to 5
      669 |           char sym = (c[j] <= 26) ? '@' + c[j] : '?';
          |                                   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:673:11: note: +5, including nesting penalty of 4, nesting level increased to 5
      673 |           if(current_color != Term::Color::Name::Default) { screen.append(color_fg(current_color)); }
          |           ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:675:14: note: +1, nesting level increased to 4
      675 |         else if(hl[j] == HL_NORMAL)
          |              ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:677:11: note: +5, including nesting penalty of 4, nesting level increased to 5
      677 |           if(current_color != Term::Color::Name::Black)
          |           ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:684:9: note: +1, nesting level increased to 4
      684 |         else
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:687:11: note: +5, including nesting penalty of 4, nesting level increased to 5
      687 |           if(color != current_color)
          |           ^

    /examples/kilo.cpp:635:11: warning: [readability-identifier-length]

    loop variable name 'y' is too short, expected at least 2 characters

      635 |   for(int y = 0; y < E.screenrows; y++)
          |           ^

    /examples/kilo.cpp:635:18: warning: [altera-id-dependent-backward-branch]

    backward branch (for loop) is ID-dependent due to member reference to 'screenrows' and may cause performance degradation

      635 |   for(int y = 0; y < E.screenrows; y++)
          |                  ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:106:3: note: inferred assignment of ID-dependent member from ID-dependent 
      106 |   std::size_t  screenrows{0};
          |   ^

    /examples/kilo.cpp:635:20: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long')

      635 |   for(int y = 0; y < E.screenrows; y++)
          |                  ~ ^ ~~~~~~~~~~~~

    /examples/kilo.cpp:637:5: warning: [misc-const-correctness]

    variable 'filerow' of type 'int' can be declared 'const'

      637 |     int filerow = y + E.rowoff;
          |     ^
          |         const 
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:637:19: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      637 |     int filerow = y + E.rowoff;
          |                   ^

    /examples/kilo.cpp:638:16: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long')

      638 |     if(filerow >= E.numrows)
          |        ~~~~~~~ ^  ~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:642:9: warning: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays]
      642 |         char welcome[80];
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:642:22: warning: 80 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
      642 |         char welcome[80];
          |                      ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:643:27: warning: do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg,hicpp-vararg]
      643 |         int  welcomelen = snprintf(welcome, sizeof(welcome), "Kilo editor -- version %s", KILO_VERSION.c_str());
          |                           ^

    /examples/kilo.cpp:643:27: warning: [misc-include-cleaner]

    no header providing "snprintf" is directly included

       27 |         int  welcomelen = snprintf(welcome, sizeof(welcome), "Kilo editor -- version %s", KILO_VERSION.c_str());
          |                           ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:643:36: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
      643 |         int  welcomelen = snprintf(welcome, sizeof(welcome), "Kilo editor -- version %s", KILO_VERSION.c_str());
          |                                    ^

    /examples/kilo.cpp:644:23: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long')

      644 |         if(welcomelen > E.screencols) welcomelen = E.screencols;
          |            ~~~~~~~~~~ ^ ~~~~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:644:38: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      644 |         if(welcomelen > E.screencols) welcomelen = E.screencols;
          |                                      ^                          
          |                                       {
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:644:52: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      644 |         if(welcomelen > E.screencols) welcomelen = E.screencols;
          |                                                    ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:645:23: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      645 |         int padding = (E.screencols - welcomelen) / 2;
          |                       ^

    /examples/kilo.cpp:646:12: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      646 |         if(padding)
          |            ^      
          |                    != 0

    /examples/kilo.cpp:651:15: warning: [altera-id-dependent-backward-branch]

    backward branch (while loop) is ID-dependent due to variable reference to 'padding' and may cause performance degradation

      651 |         while(padding--) screen.append(" ");
          |               ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:645:9: note: inferred assignment of ID-dependent value from ID-dependent member screencols
      645 |         int padding = (E.screencols - welcomelen) / 2;
          |         ^

    /examples/kilo.cpp:651:15: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      651 |         while(padding--) screen.append(" ");
          |               ^        
          |               (        ) != 0
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:651:25: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      651 |         while(padding--) screen.append(" ");
          |                         ^                   
          |                          {
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:652:23: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
      652 |         screen.append(welcome);
          |                       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:658:17: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      658 |       int len = E.row[filerow].rsize - E.coloff;
          |                 ^

    /examples/kilo.cpp:658:17: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:659:18: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      659 |       if(len < 0) len = 0;
          |                  ^        
          |                   {

    /examples/kilo.cpp:660:14: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long')

      660 |       if(len > E.screencols) len = E.screencols;
          |          ~~~ ^ ~~~~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:660:29: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      660 |       if(len > E.screencols) len = E.screencols;
          |                             ^                   
          |                              {
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:660:36: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      660 |       if(len > E.screencols) len = E.screencols;
          |                                    ^

    /examples/kilo.cpp:661:22: warning: [readability-identifier-length]

    variable name 'c' is too short, expected at least 3 characters

      661 |       char*          c             = &E.row[filerow].render[E.coloff];
          |                      ^

    /examples/kilo.cpp:661:39: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      661 |       char*          c             = &E.row[filerow].render[E.coloff];
          |                                       ^

    /examples/kilo.cpp:662:22: warning: [readability-identifier-length]

    variable name 'hl' is too short, expected at least 3 characters

      662 |       unsigned char* hl            = &E.row[filerow].hl[E.coloff];
          |                      ^

    /examples/kilo.cpp:662:39: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      662 |       unsigned char* hl            = &E.row[filerow].hl[E.coloff];
          |                                       ^

    /examples/kilo.cpp:664:22: warning: [cppcoreguidelines-init-variables]

    variable 'j' is not initialized

      664 |       int            j;
          |                      ^
          |                        = 0

    /examples/kilo.cpp:664:22: warning: [readability-identifier-length]

    variable name 'j' is too short, expected at least 3 characters

    /examples/kilo.cpp:665:18: warning: [altera-id-dependent-backward-branch]

    backward branch (for loop) is ID-dependent due to variable reference to 'len' and may cause performance degradation

      665 |       for(j = 0; j < len; j++)
          |                  ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:658:7: note: inferred assignment of ID-dependent value from ID-dependent member rsize
      658 |       int len = E.row[filerow].rsize - E.coloff;
          |       ^

    /examples/kilo.cpp:667:12: warning: [misc-include-cleaner]

    no header providing "iscntrl" is directly included

       25 |         if(iscntrl(c[j]))
          |            ^

    /examples/kilo.cpp:667:12: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      667 |         if(iscntrl(c[j]))
          |            ^            
          |                          != 0

    /examples/kilo.cpp:667:20: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      667 |         if(iscntrl(c[j]))
          |                    ^

    /examples/kilo.cpp:669:11: warning: [misc-const-correctness]

    variable 'sym' of type 'char' can be declared 'const'

      669 |           char sym = (c[j] <= 26) ? '@' + c[j] : '?';
          |           ^
          |                const 

    /examples/kilo.cpp:669:23: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      669 |           char sym = (c[j] <= 26) ? '@' + c[j] : '?';
          |                       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:669:31: warning: 26 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
      669 |           char sym = (c[j] <= 26) ? '@' + c[j] : '?';
          |                               ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:669:41: warning: narrowing conversion from 'int' to signed type 'char' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      669 |           char sym = (c[j] <= 26) ? '@' + c[j] : '?';
          |                                         ^

    /examples/kilo.cpp:669:43: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      669 |           char sym = (c[j] <= 26) ? '@' + c[j] : '?';
          |                                           ^

    /examples/kilo.cpp:675:17: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      675 |         else if(hl[j] == HL_NORMAL)
          |                 ^

    /examples/kilo.cpp:682:38: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      682 |           screen.append(std::string(&c[j], 1));
          |                                      ^

    /examples/kilo.cpp:686:11: warning: [misc-const-correctness]

    variable 'color' of type 'Term::Color' can be declared 'const'

      686 |           Term::Color color = editorSyntaxToColor(hl[j]);
          |           ^
          |                       const 

    /examples/kilo.cpp:686:51: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      686 |           Term::Color color = editorSyntaxToColor(hl[j]);
          |                                                   ^

    /examples/kilo.cpp:692:38: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      692 |           screen.append(std::string(&c[j], 1));
          |                                      ^

    /examples/kilo.cpp:698:25: warning: [misc-include-cleaner]

    no header providing "Term::clear_eol" is directly included

       12 |     screen.append(Term::clear_eol());
          |                         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:706:3: warning: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays]
      706 |   char status[80];
          |   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:706:15: warning: 80 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
      706 |   char status[80];
          |               ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:707:3: warning: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays]
      707 |   char rstatus[80];
          |   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:707:16: warning: 80 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
      707 |   char rstatus[80];
          |                ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:708:15: warning: do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg,hicpp-vararg]
      708 |   int  len  = snprintf(status, sizeof(status), "%.20s - %d lines %s", !E.filename.empty() ? E.filename.c_str() : "[No Name]", E.numrows, E.dirty ? "(modified)" : "");
          |               ^

    /examples/kilo.cpp:708:15: warning: [misc-include-cleaner]

    no header providing "snprintf" is directly included

       27 |   int  len  = snprintf(status, sizeof(status), "%.20s - %d lines %s", !E.filename.empty() ? E.filename.c_str() : "[No Name]", E.numrows, E.dirty ? "(modified)" : "");
          |               ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:708:24: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
      708 |   int  len  = snprintf(status, sizeof(status), "%.20s - %d lines %s", !E.filename.empty() ? E.filename.c_str() : "[No Name]", E.numrows, E.dirty ? "(modified)" : "");
          |                        ^

    /examples/kilo.cpp:708:127: warning: [clang-diagnostic-format]

    format specifies type 'int' but the argument has type 'std::size_t' (aka 'unsigned long')

      708 |   int  len  = snprintf(status, sizeof(status), "%.20s - %d lines %s", !E.filename.empty() ? E.filename.c_str() : "[No Name]", E.numrows, E.dirty ? "(modified)" : "");
          |                                                         ~~                                                                    ^~~~~~~~~
          |                                                         %zu

    /examples/kilo.cpp:708:138: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      708 |   int  len  = snprintf(status, sizeof(status), "%.20s - %d lines %s", !E.filename.empty() ? E.filename.c_str() : "[No Name]", E.numrows, E.dirty ? "(modified)" : "");
          |                                                                                                                                          ^
          |                                                                                                                                                  != 0

    /examples/kilo.cpp:709:3: warning: [misc-const-correctness]

    variable 'rlen' of type 'int' can be declared 'const'

      709 |   int  rlen = snprintf(rstatus, sizeof(rstatus), "%s | %ld/%ld", !E.syntax.empty() ? E.syntax.filetype.c_str() : "no ft", E.cy + 1, E.numrows);
          |   ^
          |        const 
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:709:15: warning: do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg,hicpp-vararg]
      709 |   int  rlen = snprintf(rstatus, sizeof(rstatus), "%s | %ld/%ld", !E.syntax.empty() ? E.syntax.filetype.c_str() : "no ft", E.cy + 1, E.numrows);
          |               ^

    /examples/kilo.cpp:709:15: warning: [misc-include-cleaner]

    no header providing "snprintf" is directly included

       27 |   int  rlen = snprintf(rstatus, sizeof(rstatus), "%s | %ld/%ld", !E.syntax.empty() ? E.syntax.filetype.c_str() : "no ft", E.cy + 1, E.numrows);
          |               ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:709:24: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
      709 |   int  rlen = snprintf(rstatus, sizeof(rstatus), "%s | %ld/%ld", !E.syntax.empty() ? E.syntax.filetype.c_str() : "no ft", E.cy + 1, E.numrows);
          |                        ^

    /examples/kilo.cpp:710:10: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long')

      710 |   if(len > E.screencols) len = E.screencols;
          |      ~~~ ^ ~~~~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:710:25: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      710 |   if(len > E.screencols) len = E.screencols;
          |                         ^                   
          |                          {
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:710:32: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      710 |   if(len > E.screencols) len = E.screencols;
          |                                ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:711:29: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
      711 |   screen.append(std::string(status, len));
          |                             ^

    /examples/kilo.cpp:712:9: warning: [altera-id-dependent-backward-branch]

    backward branch (while loop) is ID-dependent due to variable reference to 'len' and may cause performance degradation

      712 |   while(len < E.screencols)
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:708:3: note: inferred assignment of ID-dependent value from ID-dependent 
      708 |   int  len  = snprintf(status, sizeof(status), "%.20s - %d lines %s", !E.filename.empty() ? E.filename.c_str() : "[No Name]", E.numrows, E.dirty ? "(modified)" : "");
          |   ^

    /examples/kilo.cpp:712:13: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long')

      712 |   while(len < E.screencols)
          |         ~~~ ^ ~~~~~~~~~~~~

    /examples/kilo.cpp:714:27: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'std::size_t' (aka 'unsigned long') and 'int'

      714 |     if(E.screencols - len == rlen)
          |        ~~~~~~~~~~~~~~~~~~ ^  ~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:716:33: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
      716 |       screen.append(std::string(rstatus, rlen));
          |                                 ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:719:5: warning: do not use 'else' after 'break' [llvm-else-after-return,readability-else-after-return]
      719 |     else
          |     ^~~~
      720 |     {
          |     ~
      721 |       screen.append(" ");
          |       ~~~~~~~~~~~~~~~~~~~
      722 |       ++len;
          |       ~~~~~~
      723 |     }
          |     ~

    /examples/kilo.cpp:731:23: warning: [misc-include-cleaner]

    no header providing "Term::clear_eol" is directly included

       12 |   screen.append(Term::clear_eol());
          |                       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:732:40: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      732 |   if(E.statusmsg.size() > E.screencols) E.statusmsg.resize(E.screencols);
          |                                        ^                                 
          |                                         {

    /examples/kilo.cpp:733:31: warning: [misc-include-cleaner]

    no header providing "time" is directly included

       28 |   if(!E.statusmsg.empty() && (time(nullptr) - E.statusmsg_time) < 5) { screen.append(E.statusmsg); }
          |                               ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:733:67: warning: 5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
      733 |   if(!E.statusmsg.empty() && (time(nullptr) - E.statusmsg_time) < 5) { screen.append(E.statusmsg); }
          |                                                                   ^

    /examples/kilo.cpp:741:23: warning: [misc-include-cleaner]

    no header providing "Term::cursor_off" is directly included

       12 |   screen.append(Term::cursor_off());
          |                       ^

    /examples/kilo.cpp:742:23: warning: [misc-include-cleaner]

    no header providing "Term::cursor_move" is directly included

       12 |   screen.append(Term::cursor_move(1, 1));
          |                       ^

    /examples/kilo.cpp:746:23: warning: [misc-include-cleaner]

    no header providing "Term::cursor_move" is directly included

       12 |   screen.append(Term::cursor_move(static_cast<size_t>((E.cy - E.rowoff) + 1), static_cast<size_t>((E.rx - E.coloff) + 1)));
          |                       ^

    /examples/kilo.cpp:747:23: warning: [misc-include-cleaner]

    no header providing "Term::cursor_on" is directly included

       12 |   screen.append(Term::cursor_on());
          |                       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:756:15: warning: 128 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
      756 |   buf.reserve(128);
          |               ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:759:5: warning: do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg,hicpp-vararg]
      759 |     editorSetStatusMessage(prompt, buf.c_str());
          |     ^

    /examples/kilo.cpp:762:5: warning: [misc-const-correctness]

    variable 'c' of type 'Term::Key' can be declared 'const'

      762 |     Term::Key c = Term::read_event();
          |     ^
          |               const 

    /examples/kilo.cpp:762:15: warning: [readability-identifier-length]

    variable name 'c' is too short, expected at least 3 characters

      762 |     Term::Key c = Term::read_event();
          |               ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:764:18: warning: statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
      764 |     if(c.empty()) continue;
          |                  ^
          |                   {
      765 |     else if(c == Term::Key::Del || c == Term::Key::Ctrl_H || c == Term::Key::Backspace)
          |     } 
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:765:5: warning: do not use 'else' after 'continue' [llvm-else-after-return,readability-else-after-return]
      765 |     else if(c == Term::Key::Del || c == Term::Key::Ctrl_H || c == Term::Key::Backspace)
          |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      766 |     {
          |     ~
      767 |       if(!buf.empty()) buf.pop_back();
          |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      768 |     }
          |     ~
      769 |     else if(c == Term::Key::Esc)
          |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      770 |     {
          |     ~
      771 |       editorSetStatusMessage("");
          |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~
      772 |       if(callback) callback(buf, c);
          |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      773 |       return {};
          |       ~~~~~~~~~~
      774 |     }
          |     ~
      775 |     else if(c == Term::Key::Enter)
          |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      776 |     {
          |     ~
      777 |       if(!buf.empty())
          |       ~~~~~~~~~~~~~~~~
      778 |       {
          |       ~
      779 |         editorSetStatusMessage("");
          |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~
      780 |         if(callback) callback(buf, c);
          |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:767:23: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      767 |       if(!buf.empty()) buf.pop_back();
          |                       ^
    note: this fix will not be applied because it overlaps with another fix
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:771:7: warning: do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg,hicpp-vararg]
      771 |       editorSetStatusMessage("");
          |       ^

    /examples/kilo.cpp:772:10: warning: [readability-implicit-bool-conversion]

    implicit conversion 'void ()(std::string &, const Term::Key &)' (aka 'void ()(basic_string &, const Term::Key &)') -> bool

      772 |       if(callback) callback(buf, c);
          |          ^
    note: this fix will not be applied because it overlaps with another fix
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:772:19: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      772 |       if(callback) callback(buf, c);
          |                   ^
    note: this fix will not be applied because it overlaps with another fix
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:779:9: warning: do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg,hicpp-vararg]
      779 |         editorSetStatusMessage("");
          |         ^

    /examples/kilo.cpp:780:12: warning: [readability-implicit-bool-conversion]

    implicit conversion 'void ()(std::string &, const Term::Key &)' (aka 'void ()(basic_string &, const Term::Key &)') -> bool

      780 |         if(callback) callback(buf, c);
          |            ^
    note: this fix will not be applied because it overlaps with another fix
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:780:21: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      780 |         if(callback) callback(buf, c);
          |                     ^
    note: this fix will not be applied because it overlaps with another fix

    /examples/kilo.cpp:786:8: warning: [readability-implicit-bool-conversion]

    implicit conversion 'void ()(std::string &, const Term::Key &)' (aka 'void ()(basic_string &, const Term::Key &)') -> bool

      786 |     if(callback) callback(buf, c);
          |        ^       
          |                 != nullptr
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:786:17: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      786 |     if(callback) callback(buf, c);
          |                 ^                 
          |                  {

    /examples/kilo.cpp:792:48: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      792 |   erow* row = (E.cy >= E.numrows) ? nullptr : &E.row[E.cy];
          |                                                ^

    /examples/kilo.cpp:801:16: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      801 |         E.cx = E.row[E.cy].size;
          |                ^

    /examples/kilo.cpp:805:10: warning: [readability-implicit-bool-conversion]

    implicit conversion 'erow *' (aka '(anonymous namespace)::erow *') -> bool

      805 |       if(row && E.cx < row->size) { E.cx++; }
          |          ^
          |          (   != nullptr)

    /examples/kilo.cpp:805:22: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'std::size_t' (aka 'unsigned long') and 'int'

      805 |       if(row && E.cx < row->size) { E.cx++; }
          |                 ~~~~ ^ ~~~~~~~~~

    /examples/kilo.cpp:806:15: warning: [readability-implicit-bool-conversion]

    implicit conversion 'erow *' (aka '(anonymous namespace)::erow *') -> bool

      806 |       else if(row && E.cx == row->size)
          |               ^
          |               (   != nullptr)

    /examples/kilo.cpp:806:27: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'std::size_t' (aka 'unsigned long') and 'int'

      806 |       else if(row && E.cx == row->size)
          |                      ~~~~ ^  ~~~~~~~~~

    /examples/kilo.cpp:821:49: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      821 |   row        = (E.cy >= E.numrows) ? nullptr : &E.row[E.cy];
          |                                                 ^

    /examples/kilo.cpp:822:3: warning: [misc-const-correctness]

    variable 'rowlen' of type 'int' can be declared 'const'

      822 |   int rowlen = row ? row->size : 0;
          |   ^
          |       const 

    /examples/kilo.cpp:822:16: warning: [readability-implicit-bool-conversion]

    implicit conversion 'erow *' (aka '(anonymous namespace)::erow *') -> bool

      822 |   int rowlen = row ? row->size : 0;
          |                ^
          |                    != nullptr

    /examples/kilo.cpp:823:11: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'std::size_t' (aka 'unsigned long') and 'int'

      823 |   if(E.cx > rowlen) { E.cx = rowlen; }
          |      ~~~~ ^ ~~~~~~

    /examples/kilo.cpp:826:6: warning: [readability-function-cognitive-complexity]

    function 'editorProcessKeypress' has cognitive complexity of 39 (threshold 25)

      826 | bool editorProcessKeypress()
          |      ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:831:3: note: +1, including nesting penalty of 0, nesting level increased to 1
      831 |   switch(event.type())
          |   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:836:7: note: +2, including nesting penalty of 1, nesting level increased to 2
      836 |       switch(key)
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:845:11: note: +3, including nesting penalty of 2, nesting level increased to 3
      845 |           if(E.dirty && quit_times > 0)
          |           ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:845:22: note: +1
      845 |           if(E.dirty && quit_times > 0)
          |                      ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:865:11: note: +3, including nesting penalty of 2, nesting level increased to 3
      865 |           if(E.cy < E.numrows) { E.cx = E.row[E.cy].size; }
          |           ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:876:11: note: +3, including nesting penalty of 2, nesting level increased to 3
      876 |           if(key == Term::Key::Del) { ::editorMoveCursor(Term::Key::ArrowRight); }
          |           ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:883:11: note: +3, including nesting penalty of 2, nesting level increased to 3
      883 |           if(key == Term::Key::PageUp) { E.cy = E.rowoff; }
          |           ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:884:16: note: +1, nesting level increased to 3
      884 |           else if(key == Term::Key::PageDown)
          |                ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:887:13: note: +4, including nesting penalty of 3, nesting level increased to 4
      887 |             if(E.cy > E.numrows) E.cy = E.numrows;
          |             ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:891:11: note: +3, including nesting penalty of 2, nesting level increased to 3
      891 |           while(times--) { ::editorMoveCursor(key == Term::Key::PageUp ? Term::Key::ArrowUp : Term::Key::ArrowDown); }
          |           ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:891:72: note: +4, including nesting penalty of 3, nesting level increased to 4
      891 |           while(times--) { ::editorMoveCursor(key == Term::Key::PageUp ? Term::Key::ArrowUp : Term::Key::ArrowDown); }
          |                                                                        ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:915:11: note: +3, including nesting penalty of 2, nesting level increased to 3
      915 |           if((!key.hasCtrlAll()) && (key.isASCII())) { editorInsertChar(key); }  //FIXME UTF8 !
          |           ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:915:34: note: +1
      915 |           if((!key.hasCtrlAll()) && (key.isASCII())) { editorInsertChar(key); }  //FIXME UTF8 !
          |                                  ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:929:7: note: +2, including nesting penalty of 1, nesting level increased to 2
      929 |       switch(mouse.getButton().type())
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:933:11: note: +3, including nesting penalty of 2, nesting level increased to 3
      933 |           if(mouse.getButton().action() == Term::Button::Action::RolledDown) { ::editorMoveCursor(Term::Key::ArrowDown); }
          |           ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:934:16: note: +1, nesting level increased to 3
      934 |           else if(mouse.getButton().action() == Term::Button::Action::RolledUp) { ::editorMoveCursor(Term::Key::ArrowUp); }
          |                ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:935:11: note: +1, nesting level increased to 3
      935 |           else { break; }
          |           ^

    /examples/kilo.cpp:830:3: warning: [misc-const-correctness]

    variable 'event' of type 'Term::Event' can be declared 'const'

      830 |   Term::Event event{Term::read_event()};
          |   ^
          |               const 

    /examples/kilo.cpp:835:7: warning: [misc-const-correctness]

    variable 'key' of type 'Term::Key' can be declared 'const'

      835 |       Term::Key key = event;
          |       ^
          |                 const 

    /examples/kilo.cpp:845:14: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      845 |           if(E.dirty && quit_times > 0)
          |              ^
          |              (       != 0)
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:847:13: warning: do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg,hicpp-vararg]
      847 |             ::editorSetStatusMessage("WARNING!!! File has unsaved changes. Press Ctrl-Q %d more times to quit.", quit_times);
          |             ^

    /examples/kilo.cpp:865:41: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      865 |           if(E.cy < E.numrows) { E.cx = E.row[E.cy].size; }
          |                                         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:887:33: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      887 |             if(E.cy > E.numrows) E.cy = E.numrows;
          |                                 ^                 
          |                                  {
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:890:23: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      890 |           int times = E.screenrows;
          |                       ^

    /examples/kilo.cpp:891:17: warning: [altera-id-dependent-backward-branch]

    backward branch (while loop) is ID-dependent due to variable reference to 'times' and may cause performance degradation

      891 |           while(times--) { ::editorMoveCursor(key == Term::Key::PageUp ? Term::Key::ArrowUp : Term::Key::ArrowDown); }
          |                 ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:890:11: note: inferred assignment of ID-dependent value from ID-dependent member screenrows
      890 |           int times = E.screenrows;
          |           ^

    /examples/kilo.cpp:891:17: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      891 |           while(times--) { ::editorMoveCursor(key == Term::Key::PageUp ? Term::Key::ArrowUp : Term::Key::ArrowDown); }
          |                 ^      
          |                 (      ) != 0

    /examples/kilo.cpp:928:7: warning: [misc-const-correctness]

    variable 'mouse' of type 'Term::Mouse' can be declared 'const'

      928 |       Term::Mouse mouse = event;
          |       ^
          |                   const 
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:963:5: warning: do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg,hicpp-vararg]
      963 |     editorSetStatusMessage("HELP: Ctrl-S = save | Ctrl-Q = quit | Ctrl-F = find");
          |     ^

    /examples/kilo.cpp:970:64: warning: [performance-avoid-endl]

    do not use 'std::endl' with streams; use '\n' instead

      970 |     std::cerr << "cpp-terminal error: " << exception.what() << std::endl;
          |                                                                ^~~~~~~~~
          |                                                                '\n'

    /examples/kilo.cpp:971:5: warning: [concurrency-mt-unsafe]

    function is not thread safe

      971 |     std::exit(2);
          |     ^

    /examples/kilo.cpp:971:10: warning: [misc-include-cleaner]

    no header providing "std::exit" is directly included

       27 |     std::exit(2);
          |          ^

    /examples/kilo.cpp:973:20: warning: [misc-include-cleaner]

    no header providing "std::exception" is directly included

       28 |   catch(const std::exception& exception)
          |                    ^

    /examples/kilo.cpp:975:51: warning: [performance-avoid-endl]

    do not use 'std::endl' with streams; use '\n' instead

      975 |     std::cerr << "error: " << exception.what() << std::endl;
          |                                                   ^~~~~~~~~
          |                                                   '\n'

    /examples/kilo.cpp:976:5: warning: [concurrency-mt-unsafe]

    function is not thread safe

      976 |     std::exit(2);
          |     ^

    /examples/kilo.cpp:976:10: warning: [misc-include-cleaner]

    no header providing "std::exit" is directly included

       27 |     std::exit(2);
          |          ^

    /examples/kilo.cpp:980:38: warning: [performance-avoid-endl]

    do not use 'std::endl' with streams; use '\n' instead

      980 |     std::cerr << "Unknown error." << std::endl;
          |                                      ^~~~~~~~~
          |                                      '\n'

    /examples/kilo.cpp:981:5: warning: [concurrency-mt-unsafe]

    function is not thread safe

      981 |     std::exit(1);
          |     ^

    /examples/kilo.cpp:981:10: warning: [misc-include-cleaner]

    no header providing "std::exit" is directly included

       27 |     std::exit(1);
          |          ^

Have any feedback or feature suggestions? Share it here.

Please sign in to comment.