Record Detail

Compile Error

/in/simulation.cpp: In function 'point_t adjacentPoint(point_t, direction_t)':
/in/simulation.cpp:416:12: error: 'next_c' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     return res;
            ^~~
/in/simulation.cpp:416:12: error: 'next_r' may be used uninitialized in this function [-Werror=maybe-uninitialized]
/in/simulation.cpp: In function 'bool isEmptyAhead(const creature_t&, const grid_t&)':
/in/simulation.cpp:491:71: error: 'next_c' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     point_t next = adjacentPoint(creature.location, creature.direction);
                                                                       ^
/in/simulation.cpp:391:9: error: 'next_r' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     int next_r, next_c;
         ^~~~~~
/in/simulation.cpp: In function 'bool isWallAhead(const creature_t&, const grid_t&)':
/in/simulation.cpp:481:87: error: 'next_c' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     return pt.r >= 0 && static_cast<unsigned int>(pt.r) < grid.height && pt.c >= 0 && static_cast<unsigned int>(pt.c) < grid.width;
                                                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/in/simulation.cpp:391:17: note: 'next_c' was declared here
     int next_r, next_c;
                 ^~~~~~
/in/simulation.cpp:391:9: error: 'next_r' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     int next_r, next_c;
         ^~~~~~
/in/simulation.cpp: In function 'bool canHop(const creature_t&, const grid_t&)':
/in/simulation.cpp:481:87: error: 'next_c' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     return pt.r >= 0 && static_cast<unsigned int>(pt.r) < grid.height && pt.c >= 0 && static_cast<unsigned int>(pt.c) < grid.width;
                                                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/in/simulation.cpp:391:17: note: 'next_c' was declared here
     int next_r, next_c;
                 ^~~~~~
/in/simulation.cpp:481:25: error: 'next_r' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     return pt.r >= 0 && static_cast<unsigned int>(pt.r) < grid.height && pt.c >= 0 && static_cast<unsigned int>(pt.c) < grid.width;
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/in/simulation.cpp:391:9: note: 'next_r' was declared here
     int next_r, next_c;
         ^~~~~~
/in/simulation.cpp: In function 'void hopCreature(creature_t&, grid_t&)':
/in/simulation.cpp:514:71: error: 'next_c' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     point_t next = adjacentPoint(creature.location, creature.direction); // Get the point to hop to
                                                                       ^
/in/simulation.cpp:391:9: error: 'next_r' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     int next_r, next_c;
         ^~~~~~
/in/simulation.cpp: In function 'void infectCreature(const creature_t&, grid_t&)':
/in/simulation.cpp:539:71: error: 'next_c' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     point_t next = adjacentPoint(creature.location, creature.direction);
                                                                       ^
/in/simulation.cpp:391:9: error: 'next_r' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     int next_r, next_c;
         ^~~~~~
/in/simulation.cpp: In function 'bool isFacingSame(const creature_t&, const grid_t&)':
/in/simulation.cpp:481:87: error: 'next_c' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     return pt.r >= 0 && static_cast<unsigned int>(pt.r) < grid.height && pt.c >= 0 && static_cast<unsigned int>(pt.c) < grid.width;
                                                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/in/simulation.cpp:391:17: note: 'next_c' was declared here
     int next_r, next_c;
                 ^~~~~~
/in/simulation.cpp:440:29: error: 'next_r' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     return grid.squares[r][c];
                             ^
/in/simulation.cpp:391:9: note: 'next_r' was declared here
     int next_r, next_c;
         ^~~~~~
/in/simulation.cpp: In function 'bool isFacingEnemy(const creature_t&, const grid_t&)':
/in/simulation.cpp:481:87: error: 'next_c' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     return pt.r >= 0 && static_cast<unsigned int>(pt.r) < grid.height && pt.c >= 0 && static_cast<unsigned int>(pt.c) < grid.width;
                                                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/in/simulation.cpp:391:17: note: 'next_c' was declared here
     int next_r, next_c;
                 ^~~~~~
/in/simulation.cpp:440:29: error: 'next_r' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     return grid.squares[r][c];
                             ^
/in/simulation.cpp:391:9: note: 'next_r' was declared here
     int next_r, next_c;
         ^~~~~~
cc1plus: all warnings being treated as errors

Information

Submit By
Type
Submission
Homework
Project 3
Language
C++
Submit At
2024-11-14 20:24:28
Judged At
2024-11-14 20:24:28
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes