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

Pages: 1-4041-

Criticize GOTO.

Name: Anonymous 2009-06-29 10:55

Please, I'd like to hear what /prog/ thinks is silly about GOTO.

Name: Anonymous 2009-06-29 10:56

goto THE PLEASURE OF BEING CUMMED INSIDE

Name: Anonymous 2009-06-29 11:12

>>1
It's a poor man's continuation

Name: FrozenVoid 2009-06-29 11:20

Its dangerous when overused. In general case gotos simplify code.



______________________________________________
http://xs135.xs.to/xs135/09042/av922.jpg
orbis terrarum delenda est

Name: Anonymous 2009-06-29 11:26

LAMBDA: The Ultimate GOTO

Name: Anonymous 2009-06-29 11:45

It's only bad if you do arithmetic with the line number or use jump tables.

Name: Anonymous 2009-06-29 11:47

Programmer coding spaghetti code

Name: Anonymous 2009-06-29 11:53

I don't think there's anything inherently wrong with goto. It just requires discipline to usenot abuse. There isn't much use for it nowadays, as modern control structures are more readable and prevent the abuse.

Name: Anonymous 2009-06-29 12:14

Goto can only use labels, right? Use switch statements instead[1].

_____________________
1: Coroutines in C, http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html

Name: Anonymous 2009-06-29 12:15

goto rocks because it can create any kind of control structure.

Name: Anonymous 2009-06-29 12:17

>>10
Can it do an ``if?''

Name: Anonymous 2009-06-29 12:35

>>11
if(cond) goto DICKS

Name: Anonymous 2009-06-29 12:40

>>10
Can it ``Schönfinkelisation functions''?

Name: Anonymous 2009-06-29 12:40


goto $(1+3==4);

1:
puts("TRUE");
0:
puts("FALSE");

Name: Anonymous 2009-06-29 13:58

GOTO is awesome. One of the reasons that Java is so full of fail is that it lacks GOTO and thus forces programmers to use weird ass  boolean variables and loops that don't loop to do what could have been accomplished in one GOTO statement.

Name: Anonymous 2009-06-29 14:26

>>14
a real programmer would just write puts("TRUE"). if + and == don't work properly, or some idiot redefines 1, 3, or 4 without considering the consequences, that's someone else's problem.

Name: Anonymous 2009-06-29 15:01

>>14
goto $(1+3==4);
Wait, can you do that in C or HIBWT?

Name: Anonymous 2009-06-29 15:22

fucks like dick

Name: Anonymous 2009-06-29 15:44

>>17
i think thats perl or some shit.

Name: Anonymous 2009-06-29 15:51

>>19
definitely not perl. looks like that macfag version of php.

Name: Anonymous 2009-06-29 15:51

>>17
I just tried it in C, very hopeful that it would work.

It didn't :(

Name: Anonymous 2009-06-29 15:53

>>21
Have you ever used C?

Name: Anonymous 2009-06-29 17:07

Quote from the documentation file named "CodingStyle" of the Linux Kernel:

Albeit deprecated by some people, the equivalent of the goto statement is used frequently by compilers in form of the unconditional jump instruction.

The goto statement comes in handy when a function exits from multiple locations and some common work such as cleanup has to be done.

The rationale is:

- unconditional statements are easier to understand and follow
- nesting is reduced
- errors by not updating individual exit points when making     modifications are prevented
- saves the compiler work to optimize redundant code away ;)


int fun(int a)
{
    int result = 0;
    char *buffer = kmalloc(SIZE);

    if (buffer == NULL)
        return -ENOMEM;

    if (condition1) {
        while (loop1) {
            ...
        }
        result = 1;
        goto out;
    }
    ...
out:
    kfree(buffer);
    return result;
}

Name: Anonymous 2009-06-29 17:30

>>23
int fun(int a)
{ int result = 0;
  char *buffer = kmalloc(SIZE);
  if(buffer) result = -ENOMEM;
  else
  { if(!condition1)
    { ... }
    else
    { while(loop1)
      { ... }
      result = 1; }
    kfree(buffer); }
  return result; }

Name: Anonymous 2009-06-29 17:56

>>24
int
fun(int a)
{
    char* buffer = kmalloc(SIZE);
    if (!buffer)
        return -ENOMEM;
    kfree(buffer);
    return 1;
}

Name: Anonymous 2009-06-29 18:05

>>25
YHBT

Name: Anonymous 2009-06-29 19:01

>>26
int
fun
(
int
a
)
{
char
*
buffer
=
kmalloc
(
SIZE
)
;
if
(
!
buffer
)
return
-
ENOMEM
;
kfree
(
buffer
)
;
return
1
;
}

Name: Anonymous 2009-06-29 21:03

int fun      (
        int a
       )
                                 {
    int result = 0;
    char *buffer = kmalloc(SIZE);

    if                (
        buffer == NULL
       )
        return -ENOMEM;

    if            (
        condition1
       )   
                     {
        while       (
               loop1
              )
               {
            ...
           }
        result = 1;
        goto out;
       }
    ...
                  out:
    kfree(buffer);
    return result;
   }

Name: Anonymous 2009-06-29 21:09

>>27
int fun(int a){char*buffer=kmalloc(SIZE);if(!buffer)return -ENOMEM;kfree(buffer);return 1;}

Name: Anonymous 2009-06-29 21:24

>>29
FrozenVoid Quality

Name: Anonymous 2009-06-30 1:31

>>29
int f(int a){char*b=kmalloc(S);if(!b)return E;kfree(b);return 1;}

Name: FrozenVoid 2009-06-30 2:05

int f=(char *b=kmalloc(S))?1,kfree(b):E)

________________________________
http://xs135.xs.to/xs135/09042/av922.jpg
orbis terrarum delenda est

Name: Anonymous 2009-06-30 3:58

int fun(int a){int*b=kmalloc(SIZE);kfree(b);return b?1:-ENOMEM;}

Assuming kfree(NULL) is okay.

Name: Anonymous 2009-06-30 4:38

>>33
EXPERT FUNCTION CALL WASTER

Name: Anonymous 2009-06-30 6:14

what happened to the two ... parts?

Name: Anonymous 2009-06-30 9:53

>>34
What do you mean?  The function in question tests if a constant-sized chunk of memory can be allocated.  I wish I could remove the argument, but it's an ABI change.

>>35
NOPs.

Name: Anonymous 2009-06-30 13:06

NOPs.
you don't know that. you can't eliminate it unless you know it's a NOP.

Name: Anonymous 2009-06-30 15:18

>>37
NP-complete Object-oriented Procedures
I think it's safe to eliminate those.

Name: Anonymous 2009-06-30 15:22

I love goto.  It makes writing small scripts easy.

Name: Anonymous 2009-06-30 15:48

goto yourroom

Name: Anonymous 2009-06-30 17:12

>>40
sudo goto yourroom

Name: Anonymous 2009-06-30 17:20

>>41
sudo: goto: yourroom: label not found

Name: Anonymous 2009-06-30 17:37

>>42
yourroom(){ yourroom | yourroom& };

Name: Anonymous 2009-06-30 17:50

>>43
BLOWNMIND

Name: Anonymous 2009-07-01 0:47

Real programmers prefer longjmp and setjmp.

Name: Anonymous 2009-07-01 0:53

I consider them harmful

AND I FUCKING RRAAGGEE WHEN PEOPLE SAY CALL-WITH-CURRENT-CONTINUATION "is basically a goto"

Name: Anonymous 2009-07-01 1:17

>>46
tail calls are basically a goto

Name: Anonymous 2009-07-01 1:25

>>47
lambda is basically the Ultimate goto

Name: FrozenVoid 2009-07-01 3:15

>>46 CallCC reminds me of strtok(strings.h)

_________________________________________
http://xs135.xs.to/xs135/09042/av922.jpg
Oh no! A young masked interrupt, holding up the bus.

Name: ​​​​​​​​​​ 2010-10-23 6:19

Name: Anonymous 2010-12-09 1:50

Name: Anonymous 2010-12-10 6:44


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