This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

important bug


void main ( void );
{
 /************************************
 *                                   *
 *          Define a variable i      *
 *                                   *
 ************************************/

 unsigned int i;

 /************************************
 *                                   *
 *          Start of loop            *
 *                                   *
 ************************************/

  for ( i = 10 ; i > = 0 ; i = i - 1 )

  {

 /************************************
 *                                   *
 *          Add one to i             *
 *                                   *
 ************************************/

    i=i+1;

  }

  what is wrong ??????????

Parents
  • But the open issue here is what is "the right answer".

    An even more interesting question here is why you think a web forum should be a syntax checker? A compiler is great at handling such problems - and someone who do want answers about syntax errors would normally post the relevant part of the source code, and the relevant messages from the compiler.

    And it is a known fact that lots of people do not copy their code, but retype it, when posting here. So their questions are not related to the new syntax errors they introduce in the posting process. And in this case, the code had more than one syntax error.

    But few developers would consider syntax errors as "bug" - which is the thread title. A bug is when a program don't do what we expected.

    And the interesting loop did contain a construct that may - or may not - be seen as a bug. Or at least indicate that the program don't end up doing very much. The intention of that loop obviously very much controls the need for another loop to stop the program from exiting.

Reply
  • But the open issue here is what is "the right answer".

    An even more interesting question here is why you think a web forum should be a syntax checker? A compiler is great at handling such problems - and someone who do want answers about syntax errors would normally post the relevant part of the source code, and the relevant messages from the compiler.

    And it is a known fact that lots of people do not copy their code, but retype it, when posting here. So their questions are not related to the new syntax errors they introduce in the posting process. And in this case, the code had more than one syntax error.

    But few developers would consider syntax errors as "bug" - which is the thread title. A bug is when a program don't do what we expected.

    And the interesting loop did contain a construct that may - or may not - be seen as a bug. Or at least indicate that the program don't end up doing very much. The intention of that loop obviously very much controls the need for another loop to stop the program from exiting.

Children