Thread overview | ||||||
---|---|---|---|---|---|---|
|
December 01, 2003 Legacy coding style (wasRe: On compiler warnings...) | ||||
---|---|---|---|---|
| ||||
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 |
December 01, 2003 Re: Legacy coding style (wasRe: On compiler warnings...) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | "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. |
December 01, 2003 Re: Legacy coding style (wasRe: On compiler warnings...) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vathix | 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. > > > |
December 02, 2003 Re: Legacy coding style (wasRe: On compiler warnings...) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vathix | > 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
|
Copyright © 1999-2021 by the D Language Foundation