Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

What really grinds my gears.

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.

Name: Anonymous 2011-10-16 22:54

Visual studio
Found your problem right there.

Name: Anonymous 2011-10-16 23:03

C#
Found your problem right there.

Name: Anonymous 2011-10-16 23:04

>>2
>>3
Now OP had TWO problems.

Name: Anonymous 2011-10-16 23:25

Are those warning errors or will it not even run?

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

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?

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.

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;
    }
}

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;
}

Name: Anonymous 2011-10-17 7:36

#define bcase break;case

Name: Anonymous 2011-10-17 7:51

>>10
goto case 1;

That's... that's just terrible.

Name: Anonymous 2011-10-17 8:23

>>11
That just made me vomit in my own mouth.

Name: Duke 2011-10-17 8:28

>>13
suck it down

Name: Anonymous 2011-10-17 9:21

>>9
myth busted thread fucking over

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'.

Name: Anonymous 2011-10-17 9:55

If it ain't Lisp, it's crap.

Name: Anonymous 2011-10-17 11:57

plain C is the only language that got switch/case right
WHBTC

Name: Anonymous 2011-10-17 12:54

>>17
Lisp is shit.

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;

                }

Name: Anonymous 2011-10-17 15:46

>>17
name a OS made with lisp...

Name: Anonymous 2011-10-17 15:50

>>21
Genera, Movitz and a few Scheme kernerls.

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.

Name: Anonymous 2011-10-17 16:00

>>22
Now name a real OS on which you can play Touhou games.

Name: Anonymous 2011-10-17 17:37

>>24
Just use the wine ports.

Name: Anonymous 2011-10-17 17:44

goto does not work on C#.

Name: Anonymous 2011-10-17 18:07

some linux dev choices, thats what grinds my fucking grfuck you

Name: Anonymous 2011-10-18 2:32


switch(amazing) {
    case 1:
    case 2:
    case 3:
        System.out.println("Use Java");
}

Name: Anonymous 2011-10-18 2:41

java > C#

inb4 shitstorm
inb4 polecat kebabs
inb4 fuck off and die you co

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.

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.

Name: Anonymous 2011-10-18 9:00

>>30
It's an anagram.

Name: Anonymous 2011-10-18 9:14

>>30
Nope, James Gosling never worked for Microsoft.

Name: Anonymous 2011-10-18 9:22

>>30
C# was designed by the Turbo Pascal/Delphi guy.

>>32
An anagram of what?

Name: Anonymous 2011-10-18 9:26

This will really grind your gears.


foo = [[1]] * 2
print foo
foo[0][0] = 2
print foo

Name: Anonymous 2011-10-18 9:28

>>34
back to /b/, please

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.

Name: Anonymous 2011-10-18 9:34

The real wtf: Having separate list and tuple types instead of giving lists a .freeze method.

Name: Anonymous 2011-10-18 9:36

>>38
It's easier to differ between two different classes than looking at some property.

Name: Anonymous 2011-10-18 9:53

>>36
NO Uoooh, I see.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List