What really grinds my gears.
1
Name:
Anonymous
2011-10-16 22:47
If I do this with C#:
switch(foo) {
case 0:
case 1:
}
Visual studio gives me an error because some idiot decided that in C# it won't let you fall through to the next case label anymore.
But if I do this:
switch(foo) {
case 0:
int bar = 3;
break;
case 1:
int bar = 4;
break;
}
It gives me an error about redefining my variable, EVEN THOUGH YOU'VE FORCED ME TO MAKE EVERY "case" CLAUSE A COMPLETELY SEPARATE ENTITY.
2
Name:
Anonymous
2011-10-16 22:54
Visual studio
Found your problem right there.
3
Name:
Anonymous
2011-10-16 23:03
C#
Found your problem right there.
4
Name:
Anonymous
2011-10-16 23:04
>>2
>>3
Now OP had
TWO problems.
5
Name:
Anonymous
2011-10-16 23:25
Are those warning errors or will it not even run?
6
Name:
Anonymous
2011-10-17 2:54
>>5
Both break the compile
First case:
error CS0163: Control cannot fall through from one case label ('case 1:') to another
Second:
error CS0128: A local variable named 'bar' is already defined in this scope
7
Name:
Anonymous
2011-10-17 4:38
If I do this with C#:
http://msdn.microsoft.com/en-us/library/06tc147t(v=vs.71).aspx
Although fall through from one case label to another is
not supported, it is allowed to stack case labels, for example:
case 0:
case 1:
// do something;
What?
8
Name:
Anonymous
2011-10-17 5:55
>>6
>>7
I think it's because you're actually falling out of the entire switch without a break.
For me,
switch(0) {
case 0:
case 1:
}
doesn't compile, but
switch(0) {
case 0:
case 1:
break;
}
does.
9
Name:
Anonymous
2011-10-17 6:08
>>1
how do you scope ?
switch(foo) {
case 0:
{
int bar = 3;
break;
}
case 1:
{
int bar = 4;
break;
}
}
10
Name:
Anonymous
2011-10-17 6:40
You are not yet an EXPERT PROGRAMMER . If you want to achieve satori , you can do this:
int bar = 0;
switch (foo) {
case 0: bar = 3; goto case 1;
case 1: Bar();
break;
case 2: bar = 4; Baz(); break;
}
11
Name:
Anonymous
2011-10-17 7:36
#define bcase break;case
12
Name:
Anonymous
2011-10-17 7:51
>>10
goto case 1;
That's... that's just terrible.
13
Name:
Anonymous
2011-10-17 8:23
>>11
That just made me vomit in my own mouth.
14
Name:
Duke
2011-10-17 8:28
15
Name:
Anonymous
2011-10-17 9:21
>>9
myth busted thread fucking over
16
Name:
Anonymous
2011-10-17 9:33
>>12
That's actually awesome, I was writing a FSA in C++ recently and sorely missed 'goto case'.
17
Name:
Anonymous
2011-10-17 9:55
If it ain't Lisp, it's crap.
18
Name:
Anonymous
2011-10-17 11:57
plain C is the only language that got switch/case right
WHBTC
19
Name:
Anonymous
2011-10-17 12:54
20
Name:
Anonymous
2011-10-17 13:24
>>1
Yep! Algol based languages get only uglier with time. Here is how you solve case problem:
if ( s.Length - i > 0 )
{
switch ( s.Length - i )
{
case 12:
esi += (uint) s[ i + 11 ] << 24;
goto case 11;
case 11:
esi += (uint) s[ i + 10 ] << 16;
goto case 10;
case 10:
esi += (uint) s[ i + 9 ] << 8;
goto case 9;
case 9:
esi += (uint) s[ i + 8 ];
goto case 8;
case 8:
edi += (uint) s[ i + 7 ] << 24;
goto case 7;
case 7:
edi += (uint) s[ i + 6 ] << 16;
goto case 6;
case 6:
edi += (uint) s[ i + 5 ] << 8;
goto case 5;
case 5:
edi += (uint) s[ i + 4 ];
goto case 4;
case 4:
ebx += (uint) s[ i + 3 ] << 24;
goto case 3;
case 3:
ebx += (uint) s[ i + 2 ] << 16;
goto case 2;
case 2:
ebx += (uint) s[ i + 1 ] << 8;
goto case 1;
case 1:
ebx += (uint) s[ i ];
break;
}
21
Name:
Anonymous
2011-10-17 15:46
>>17
name a OS made with lisp...
22
Name:
Anonymous
2011-10-17 15:50
>>21
Genera, Movitz and a few Scheme kernerls.
23
Name:
Anonymous
2011-10-17 15:53
Also, production quality Lisp OS would need something like
http://www.frank-buss.de/lispcpu/index.html to eliminate dynamic typing disadvantage to C.
24
Name:
Anonymous
2011-10-17 16:00
>>22
Now name a real OS on which you can play Touhou games.
25
Name:
Anonymous
2011-10-17 17:37
>>24
Just use the wine ports.
26
Name:
Anonymous
2011-10-17 17:44
goto does not work on C#.
27
Name:
Anonymous
2011-10-17 18:07
some linux dev choices, thats what grinds my fucking grfuck you
28
Name:
Anonymous
2011-10-18 2:32
switch(amazing) {
case 1:
case 2:
case 3:
System.out.println("Use Java");
}
29
Name:
Anonymous
2011-10-18 2:41
java > C#
inb4 shitstorm
inb4 polecat kebabs
inb4 fuck off and die you co
30
Name:
Anonymous
2011-10-18 8:41
>>29
Why does the term "polekat kebabs" suddenly make some people here snap off? What's the joke in it?
Also, C# > Java. It's made by the same guy, 10 years later. He fixed ONE AND ANOTHER thing. Of course, MS made up new failures to it.
31
Name:
Anonymous
2011-10-18 8:46
>>16
You don't really need
goto case in Sepples because plain old
goto works fine:
S: switch(foo) {
C0: case 0:
bar();
goto C2;
C1: case 1:
foo = baz();
goto S;
C2: case 2:
qux();
break;
}
Forgive me if some small detail is incorrect but I believe this is more-or-less valid Sepples.
32
Name:
Anonymous
2011-10-18 9:00
33
Name:
Anonymous
2011-10-18 9:14
>>30
Nope, James Gosling never worked for Microsoft.
34
Name:
Anonymous
2011-10-18 9:22
>>30
C# was designed by the Turbo Pascal/Delphi guy.
>>32
An anagram of what?
35
Name:
Anonymous
2011-10-18 9:26
This will really grind your gears.
foo = [[1]] * 2
print foo
foo[0][0] = 2
print foo
36
Name:
Anonymous
2011-10-18 9:28
37
Name:
Anonymous
2011-10-18 9:32
>>35
That's just because you multiply
the same list two times, not two different lists. That's normal.
38
Name:
Anonymous
2011-10-18 9:34
The real wtf: Having separate list and tuple types instead of giving lists a .freeze method.
39
Name:
Anonymous
2011-10-18 9:36
>>38
It's easier to differ between two different classes than looking at some property.
40
Name:
Anonymous
2011-10-18 9:53
41
Name:
Anonymous
2011-10-18 11:12
What really grinds my gears: Someone who would actually learn C# in the first place, then take the time to make forum posts about what a bad language it is.
42
Name:
Anonymous
2011-10-18 15:06
use python and a dictionary full of lambdas, ``faggot''
43
Name:
Anonymous
2011-10-18 15:21
>>42
lambda considered unpythonic
!!
44
Name:
Anonymous
2011-10-18 16:04
>>42, 43
how about the much more elegant method:
def case_a():
pass
def case_b():
pass
def case_c():
pass
def default():
pass
mycase = 1
print { 0: case_a, 1: case_b, 2: case_c }.get(1, default)
45
Name:
Anonymous
2011-10-18 17:58
46
Name:
Anonymous
2011-10-18 21:06
if case == 0:
pass
elif case == 1:
pass
elif case == 2:
pass
else:
pass
Less typing, less namespace pollution. Derp.
47
Name:
Anonymous
2011-10-18 23:05
>>46
enjoy your O(n) ``faggot switch statement'', ``faggot''
48
Name:
Anonymous
2011-10-19 12:47
PyBump
49
Name:
Anonymous
2011-10-19 14:15