Click here to Skip to main content
14,355,784 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
Jörgen Andersson14-Sep-19 5:18
protectorJörgen Andersson14-Sep-19 5:18 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
honey the codewitch14-Sep-19 5:22
memberhoney the codewitch14-Sep-19 5:22 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
Jörgen Andersson14-Sep-19 5:49
protectorJörgen Andersson14-Sep-19 5:49 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
honey the codewitch14-Sep-19 6:01
memberhoney the codewitch14-Sep-19 6:01 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
OriginalGriff14-Sep-19 5:07
protectorOriginalGriff14-Sep-19 5:07 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
honey the codewitch14-Sep-19 5:09
memberhoney the codewitch14-Sep-19 5:09 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
Nand3214-Sep-19 5:17
memberNand3214-Sep-19 5:17 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
honey the codewitch14-Sep-19 5:20
memberhoney the codewitch14-Sep-19 5:20 
ugh, VB. I use goto in some of my code.

Perfectly acceptable place to use GOTO - generated state machine code:

public static bool AcceptsByte(Grimoire.ParseContext pc)
{
	pc.EnsureStarted();
	if (-1 == pc.Current) return false;
	if ((48 == pc.Current))
	{
		pc.Advance();
		goto AcceptsByte_s1;
	}
	if ((49 == pc.Current))
	{
		pc.Advance();
		goto AcceptsByte_s2;
	}
	if ((50 == pc.Current))
	{
		pc.Advance();
		goto AcceptsByte_s4;
	}
	if ((51 <= pc.Current && 57 >= pc.Current))
	{
		pc.Advance();
		goto AcceptsByte_s3;
	}
	return false;
AcceptsByte_s1:
	if (-1 == pc.Current) return true;
	return -1 == pc.Advance();
AcceptsByte_s2:
	if (-1 == pc.Current) return true;
	if ((48 <= pc.Current && 57 >= pc.Current))
	{
		pc.Advance();
		goto AcceptsByte_s3;
	}
	return -1 == pc.Advance();
AcceptsByte_s3:
	if (-1 == pc.Current) return true;
	if ((48 <= pc.Current && 57 >= pc.Current))
	{
		pc.Advance();
		goto AcceptsByte_s1;
	}
	return -1 == pc.Advance();
AcceptsByte_s4:
	if (-1 == pc.Current) return true;
	if ((48 <= pc.Current && 52 >= pc.Current))
	{
		pc.Advance();
		goto AcceptsByte_s3;
	}
	if ((53 == pc.Current))
	{
		pc.Advance();
		goto AcceptsByte_s5;
	}
	if ((54 <= pc.Current && 57 >= pc.Current))
	{
		pc.Advance();
		goto AcceptsByte_s1;
	}
	return -1 == pc.Advance();
AcceptsByte_s5:
	if (-1 == pc.Current) return true;
	if ((48 <= pc.Current && 52 >= pc.Current))
	{
		pc.Advance();
		goto AcceptsByte_s1;
	}
	return -1 == pc.Advance();
}


but then I wouldn't write that code by hand. Too error prone.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

GeneralRe: for those of you purists that don't like break, continue and goto Pin
Nand3214-Sep-19 5:26
memberNand3214-Sep-19 5:26 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
honey the codewitch14-Sep-19 5:28
memberhoney the codewitch14-Sep-19 5:28 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
John Brett15-Sep-19 22:21
memberJohn Brett15-Sep-19 22:21 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
Andrew Leeder16-Sep-19 0:29
memberAndrew Leeder16-Sep-19 0:29 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
honey the codewitch16-Sep-19 1:29
memberhoney the codewitch16-Sep-19 1:29 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
John Brett16-Sep-19 1:35
memberJohn Brett16-Sep-19 1:35 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
honey the codewitch16-Sep-19 1:39
memberhoney the codewitch16-Sep-19 1:39 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
lopatir14-Sep-19 5:14
memberlopatir14-Sep-19 5:14 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
honey the codewitch14-Sep-19 5:17
memberhoney the codewitch14-Sep-19 5:17 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
Member 798912216-Sep-19 0:13
memberMember 798912216-Sep-19 0:13 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
GuyThiebaut14-Sep-19 5:11
professionalGuyThiebaut14-Sep-19 5:11 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
honey the codewitch14-Sep-19 5:15
memberhoney the codewitch14-Sep-19 5:15 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
lopatir14-Sep-19 5:22
memberlopatir14-Sep-19 5:22 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
honey the codewitch14-Sep-19 5:24
memberhoney the codewitch14-Sep-19 5:24 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
GuyThiebaut14-Sep-19 5:24
professionalGuyThiebaut14-Sep-19 5:24 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
honey the codewitch14-Sep-19 5:26
memberhoney the codewitch14-Sep-19 5:26 
GeneralRe: for those of you purists that don't like break, continue and goto Pin
Nand3214-Sep-19 5:25
memberNand3214-Sep-19 5:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.