www.digitalmars.com         C & C++   DMDScript  

D - Legacy coding style (wasRe: On compiler warnings...)

reply Ant <Ant_member pathlink.com> writes:
In article <bqfiuc$vsf$1 digitaldaemon.com>, Berin Loritsch says...
Walter wrote:
 
     int foo()
     {
         while (1)
         {
                 ....
                     return ...;
         }
     }
 
There are a couple things I really don't like about that code anyway.>
int foo() {
      while(true) {
           .....
                break;
      }

      return ...;
}
I never use goto, continue or break (except on switch) and I try to have only one exit point on the functions, at the end (sometimes I get lazy). "goto", "continue" and "break" should be removed from the language. break on switch should be implicit and case should handle multiple values "case 1,2,1024,8:" but, of course, that can't be done... :( I thought we had goto, continue and break just to support conversions from older languages but I've seen it used on new code! I'm very desapointed... <joke> the D compiler should also limite the number of lines in a function/method, let's say 50</joke> Ant
Dec 01 2003
parent reply "Vathix" <vathix dprogramming.com> writes:
"Ant" <Ant_member pathlink.com> wrote in message
news:bqfqe6$1c7d$1 digitaldaemon.com...
 In article <bqfiuc$vsf$1 digitaldaemon.com>, Berin Loritsch says...
Walter wrote:
     int foo()
     {
         while (1)
         {
                 ....
                     return ...;
         }
     }
There are a couple things I really don't like about that code anyway.>
int foo() {
      while(true) {
           .....
                break;
      }

      return ...;
}
I never use goto, continue or break (except on switch) and I try to have only one exit point on the functions, at the end (sometimes I get lazy). "goto", "continue" and "break" should be removed from the language. break on switch should be implicit and case should handle multiple values "case 1,2,1024,8:" but, of course, that can't be done... :( I thought we had goto, continue and break just to support conversions from older languages but I've seen it used on new code! I'm very desapointed... <joke> the D compiler should also limite the number of lines in a function/method, let's say 50</joke> Ant
I use goto all the time and I'd be pretty disappointed if I couldn't use it anymore. goto is just easier in my opinion. You can directly do what you want without having to rethink a loop or indent a ton of code for a new if statement. I don't recall having goto be a problem for me; but I usually code alone. People say they hate goto; well, I hate goto haters :) just kidding.
Dec 01 2003
next sibling parent "Charles Sanders" <sanders-consulting comcast.net> writes:
Yea i noticed alot of gotos in ini.d ;) ( Very cool module btw!)

I think goto is a good tool to use when appropriate, i think goto got alot
of flack from languages like basic where all of the flow is based on gotos!

C


"Vathix" <vathix dprogramming.com> wrote in message
news:bqg9kr$23ih$1 digitaldaemon.com...
 "Ant" <Ant_member pathlink.com> wrote in message
 news:bqfqe6$1c7d$1 digitaldaemon.com...
 In article <bqfiuc$vsf$1 digitaldaemon.com>, Berin Loritsch says...
Walter wrote:
     int foo()
     {
         while (1)
         {
                 ....
                     return ...;
         }
     }
There are a couple things I really don't like about that code anyway.>
int foo() {
      while(true) {
           .....
                break;
      }

      return ...;
}
I never use goto, continue or break (except on switch) and I try to have only one exit point on the functions, at the end (sometimes I get lazy). "goto", "continue" and "break" should be removed from the language. break on switch should be implicit and case should handle multiple values "case 1,2,1024,8:" but, of course, that can't be done... :( I thought we had goto, continue and break just to support conversions from older languages but I've seen it used on new code! I'm very desapointed... <joke> the D compiler should also limite the number of lines in a function/method, let's say 50</joke> Ant
I use goto all the time and I'd be pretty disappointed if I couldn't use
it
 anymore. goto is just easier in my opinion. You can directly do what you
 want without having to rethink a loop or indent a ton of code for a new if
 statement. I don't recall having goto be a problem for me; but I usually
 code alone.
 People say they hate goto; well, I hate goto haters :) just kidding.
Dec 01 2003
prev sibling parent Ant <duitoolkit yahoo.ca> writes:
 I use goto all the time and I'd be pretty disappointed if I couldn't use it
 anymore. goto is just easier in my opinion. You can directly do what you
 want without having to rethink a loop or indent a ton of code for a new if
 statement. I don't recall having goto be a problem for me; but I usually
 code alone.
 People say they hate goto; well, I hate goto haters :) just kidding.
Browsing through your the ini I understand what you mean. We just think differently, no I don't mean we have different oppinions, I mean: our thought process is really different. Hey, friends all the same! Ant
Dec 01 2003