comparing java and C ++(labeling)

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jul 2004
Posts: 1,749
Reputation: nanosani is an unknown quantity at this point 
Solved Threads: 54
Team Colleague
nanosani's Avatar
nanosani nanosani is offline Offline
Unauthenticated Liar

comparing java and C ++(labeling)

 
0
  #1
Aug 19th, 2004
While reading a topic in my book on comparison between java and c ++ ... I read one difference .....

java statements can be labeled while c++ statements cant be. Can anybuddy tell the use of labeling in java?
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 153
Reputation: cosi is an unknown quantity at this point 
Solved Threads: 1
cosi's Avatar
cosi cosi is offline Offline
Junior Poster

Re: comparing java and C ++(labeling)

 
0
  #2
Aug 19th, 2004
I assume you are refering to labels like this? http://www.janeg.ca/scjp/flow/labels.html

I personally never use labelling in Java and I rarely see it used. To me it feels like a primitive feature that I'd use back with asm compilers. I think it is good programming practice to avoid constructs that resemble GOTO. Code with GOTOs are generally harder to follow.

Most of the time, I use break and continue without labels. I think the only example of code that I can remember in recent memory that could have benefitted from labels for an parameter-search/optimization problem similar to the basic artificial intelligence algorithm A-Star. Oh actually... I wrote some C code to do with cache tiling optimizations in the processor that might have benefitted from labels, but usually these are exceptions to the rule.


Ed
In a world without walls or fences,
What use are Windows and Gates.
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 1,749
Reputation: nanosani is an unknown quantity at this point 
Solved Threads: 54
Team Colleague
nanosani's Avatar
nanosani nanosani is offline Offline
Unauthenticated Liar

Re: comparing java and C ++(labeling)

 
0
  #3
Aug 20th, 2004
Thanks for all that ... but I needed to know how it works... cuz even if I dont use it in my code ... its not good that I dont learn it.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC