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

Conditional jumps Assembly Vs C part01

Hello friends, In Assembly editor in KEIL (for 89LPC9xx series), things go easy. You make a jump point AT ANY LINE of main code(like point0:) and then you can conditionally jump back there to do something or reloop, according to program needs. Is there any chance you can do it with C ( ? ? ). Ofc there are (as i, a newbie knows) some looping statements like while() or for () - but in a specific application i am working these arent enough :(

I have the full flowing diagram of the code i need and i can email it to you just to see. If it was assembly it should be done by me and ready to release the project it in production line, but for C.... I am stuck for now...

Best regards all :)
Timothy Kondos

Parents
  • The biggest reason for goto is people who wants to implement the full logic in a single function, just as they can (but should they?) implement the full in a single big block of assembler instructions.

    One problem with splitting an alorithm into multiple functions is how to share state information between the individual functions. But that is the reason why the world got object-oriented languages.

    The funny thing is that when a book describes the use of goto, the typical example is almost always trivially simple to rewrite to use the normal loop constructs. Just as all programming books has to take the factorial or Fibonacci series as examples of recursive functions, even if they are even simpler (and way more efficient) to implement as loops.

Reply
  • The biggest reason for goto is people who wants to implement the full logic in a single function, just as they can (but should they?) implement the full in a single big block of assembler instructions.

    One problem with splitting an alorithm into multiple functions is how to share state information between the individual functions. But that is the reason why the world got object-oriented languages.

    The funny thing is that when a book describes the use of goto, the typical example is almost always trivially simple to rewrite to use the normal loop constructs. Just as all programming books has to take the factorial or Fibonacci series as examples of recursive functions, even if they are even simpler (and way more efficient) to implement as loops.

Children
No data