Page 1 of 7 1234 ... LastLast
Results 1 to 10 of 65
  1. #1

    Default goto statement - any comment


    Hey guys, for your opinion, what part in programming can goto statement can provide??

    Most of the programmers comment goto statement as a sucks!!!!

    But, if that sucks, why is it exists??
    Even Linus Torvalds use goto statements on his codes....


    Comments mga programmers......

  2. #2

    Default Re: goto statement - any comment

    one usage bay is sa loops.. for example naa ka 3 ka nested loops unya somewhere sa imong inner most loop kailangan ka magjump pagawas sa outermost loop nimo..gamit kau ang goto diha bay

  3. #3

    Default Re: goto statement - any comment

    But bati nasad kaau imo program if naa ka 3 jud ka nested loops. You must aviod to have it and design a program that must not exceed 2 nested loops...

    hehehe.... pero, sakto sad bitaw ka. But other experts would not recommend to use it. If that is the situation, they will recommend you to redesign your program to eliminate more than 2 nested loops....

    You have a point also....

  4. #4

    Default Re: goto statement - any comment

    yep becuase gotos can sometimes be very confusing and makes your program very hard to read especially kung dili kau technical or kung dili familiar sa language ang magbasa..pero it is provided in cases where you can do nothing to produce the desired result except by using it..

  5. #5

    Default Re: goto statement - any comment

    until you have the reason why you need goto, so dont bother.

    if i quoted it correctly, what you do not know does not harm you - bjarne stroustrup

    I havent created a program with goto and deep nested loops either because

    ------
    for(xyz)
    {
    Â* Â*for(abc);
    }
    ---

    is doable to:

    for(xyz) {

    }

    for(abc)
    {

    }

    and the latter is more readable.

  6. #6

    Default Re: goto statement - any comment

    Quote Originally Posted by zengatsu
    one usage bay is sa loops.. for example naa ka 3 ka nested loops unya somewhere sa imong inner most loop kailangan ka magjump pagawas sa outermost loop nimo..gamit kau ang goto diha bay

    i can use break and flags, its far more readable than goto

    gloryhunter: huH?! both code snippet are different...i dont know how u able to simply a loop with an inner loop inside by only using double loops...

  7. #7

    Default Re: goto statement - any comment

    @maldito imo sad na bay..pero kung nested loops i think mas readable ang goto plus mas gamay pa change nga masayop ka sa imong flags

    @gloryhunter lain2 man na ang mabuhat anang duha ka loops nga imong example bay

  8. #8

    Default Re: goto statement - any comment

    i can prove that it's doable

    here's a concrete example

    Type[][] o = // ...creation here

    for (int i = 0; i < MAX_ROW; i++)
    {
    Â* Â*o[i][0].doSomething();
    Â* Â*o[i][1].doSomething();
    Â* Â*o[i][2].doSomething();
    }

    for (int j = 0; j < MAX_COL; j++)
    {
    Â* Â*o[0][j].doSomething();Â* Â*
    Â* Â*o[1][j].doSomething();Â*
    Â* Â*o[2][j].doSomething();
    }


    anyway in practice i barely have 3 nested loops.



  9. #9

    Default Re: goto statement - any comment

    poydi ma gamit ang goto kong kanang naai error.. then mo jump lang dayon siya sa pinaka taposan sa function...

    mora og vb ehehehe

    on error goto ERRORHANDLER:

    sa asembly gamit kaau nang goto(jmp) mao lang lang na ako..

    ge discourage lang nang goto.. to prevent spaghetti code..

  10. #10

    Default Re: goto statement - any comment

    Quote Originally Posted by gloryhunter
    i can prove that it's doable

    here's a concrete example

    Type[][] o = // ...creation here

    for (int i = 0; i < MAX_ROW; i++)
    {
    o[i][0].doSomething();
    o[i][1].doSomething();
    o[i][2].doSomething();
    }

    for (int j = 0; j < MAX_COL; j++)
    {
    o[0][j].doSomething();
    o[1][j].doSomething();
    o[2][j].doSomething();
    }


    anyway in practice i barely have 3 nested loops.


    this is ridicolous..what if you are processing 1 million data or columns? in real programming practice ur not handling 2 or 3 columns...from ur example imo lang unta nang gi pakatay tanan, wla nalang unta ka ga loop.


    silent-kill: error? u can use exception..try..catch() block then throw if u catch something..

    anyway depende rapud na ninyo if mo use mo goto kung wa na jud choice then use it, but u have to consider readability and maintainability sa imong code.

    Personally i use goto in assembly language...way lain choice jud hahahaha :P pero high level programming languages wa jud ever



  11.    Advertisement

Page 1 of 7 1234 ... LastLast

Similar Threads

 
  1. Any comments on Lami-Ah??
    By darkwing in forum Food & Dining
    Replies: 10
    Last Post: 02-21-2009, 06:37 AM
  2. Replies: 4
    Last Post: 10-05-2007, 10:12 PM
  3. any comment sa Palit gf8500gt sonic and gt8600gt sonic
    By baijo in forum Computer Hardware
    Replies: 28
    Last Post: 06-01-2007, 11:12 PM
  4. Comparing 3 Switches, Any Comments...
    By Chipmunk888 in forum Networking & Internet
    Replies: 21
    Last Post: 10-27-2006, 07:45 AM
  5. Brighton monitor? Any comment on this?
    By erik garcia in forum Computer Hardware
    Replies: 2
    Last Post: 12-03-2005, 10:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top