Record Detail

Compile Error

/in/p3.cpp: In function 'int main(int, char**)':
/in/p3.cpp:30:31: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
             for (int j = 0; j < world.numCreatures; j++) {
                             ~~^~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
/in/simulation.cpp: In function 'bool initWorld(world_t&, const string&, const string&)':
/in/simulation.cpp:91:31: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
             for (int i = 0; i < world.numSpecies; i++) {
                             ~~^~~~~~~~~~~~~~~~~~
/in/simulation.cpp:112:46: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
             if (initialRow < 0 || initialRow >= world.grid.height || initialColumn < 0 || initialColumn >= world.grid.width) {
                                   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
/in/simulation.cpp:112:105: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
             if (initialRow < 0 || initialRow >= world.grid.height || initialColumn < 0 || initialColumn >= world.grid.width) {
                                                                                           ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
/in/simulation.cpp:124:31: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
             for (int i = 0; i < world.numSpecies; i++) {
                             ~~^~~~~~~~~~~~~~~~~~
/in/simulation.cpp: In function 'void simulateCreature(creature_t&, grid_t&, bool)':
/in/simulation.cpp:173:61: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
                     if (newLocation.r >= 0 && newLocation.r < grid.height && newLocation.c >= 0 && newLocation.c < grid.width &&!grid.squares[newLocation.r][newLocation.c]) {
                                               ~~~~~~~~~~~~~~^~~~~~~~~~~~~
/in/simulation.cpp:173:114: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
                     if (newLocation.r >= 0 && newLocation.r < grid.height && newLocation.c >= 0 && newLocation.c < grid.width &&!grid.squares[newLocation.r][newLocation.c]) {
                                                                                                    ~~~~~~~~~~~~~~^~~~~~~~~~~~
/in/simulation.cpp:203:67: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
                     if (targetLocation.r >= 0 && targetLocation.r < grid.height && targetLocation.c >= 0 && targetLocation.c < grid.width &&!grid.squares[targetLocation.r][targetLocation.c]) {
                                                  ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
/in/simulation.cpp:203:126: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
                     if (targetLocation.r >= 0 && targetLocation.r < grid.height && targetLocation.c >= 0 && targetLocation.c < grid.width &&!grid.squares[targetLocation.r][targetLocation.c]) {
                                                                                                             ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
/in/simulation.cpp:232:66: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
                     if (targetLocation.r < 0 || targetLocation.r >= grid.height || targetLocation.c < 0 || targetLocation.c >= grid.width) {
                                                 ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
/in/simulation.cpp:232:125: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
                     if (targetLocation.r < 0 || targetLocation.r >= grid.height || targetLocation.c < 0 || targetLocation.c >= grid.width) {
                                                                                                            ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
/in/simulation.cpp: In function 'void printGrid(const grid_t&)':
/in/simulation.cpp:260:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     for (int i = 0; i < grid.height; i++) {
                     ~~^~~~~~~~~~~~~
/in/simulation.cpp:261:27: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
         for (int j = 0; j < grid.width; j++) {
                         ~~^~~~~~~~~~~~
/in/simulation.cpp: In function 'bool initWorld(world_t&, const string&, const string&)':
/in/simulation.cpp:50:60: error: 'op' may be used uninitialized in this function [-Werror=maybe-uninitialized]
                     species.program[species.programSize++] = {op, address};
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors

Information

Submit By
Type
Submission
Homework
Project 3
Language
C++
Submit At
2024-11-11 19:29:06
Judged At
2024-11-11 19:29:06
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes