Posts
70
Following
27
Followers
24
i do not have antlers
repeated
repeated
Pilgrim in a Rocky Valley, Carl Gustav Carus, oil on canvas, c. 1820
2
4
2
repeated

ヅヅヅヅマックスフェルスタッペン

0
1
1
repeated
Edited 3 days ago

Reminded of this in conversation recently: possibly the nastiest piece of abuse of the C switch statement rules I know of that _wasn't_ done by either me or Tom Duff. This was contributed to 's terminal code in 2000 as part of a much larger patch (and removed again in a 2001 rewrite).

The switch is processing the final character of one of the terminal escape sequences ESC#3, ESC#4, ESC#5, ESC#6 and ESC#8. Four of them do something very similar: they set an attribute on the current terminal line (indicating whether the text is double-width or double-height). The fifth is the odd one out. So you want a switch statement in which four of the five cases share _most_ of their code: each sets the line attribute to a different value, but the code for actually writing it into the terminal is the same.

You could write four case statements sharing a handler, and have a secondary switch inside the handler to choose the attribute. Or you could have four separate handlers that choose an attribute value, then hold your nose and write a 'goto' from each one to the shared code that writes it into the terminal data. Or you could put the shared code in a subroutine a long way away from here, and have four independent case handlers all call it with a different parameter.

Or you could do this, which complies with the letter of 'don't use goto', but makes you wish it hadn't! Control enters at one of the four case statements, and after setting the attribute variable, it then skips over each of the following case labels because of the if (0) { ... }. Then all of them fall through to the shared handler.

2
2
0
@hj @eal new ip/routing issue: no route to host
0
0
0
@eal me everytime someone is using inferior software
0
0
1
@whirly the prune juice thing is real
0
0
0
repeated

THINGS TO SAY TO YOUR BUS DRIVER

  • does this bus go Forward or Backward
  • when is the Z line coming
  • Thank You
  • is this bus going to Rome
  • I brought my Own Vehicle
  • What are your intentions with my Gillig

-carrie

1
6
6
looking at the post like

...lpg SHIP.....
0
0
0
что что что
1
0
0
repeated
todays snacks bobby thread(huh?): batteries (plus bobby special interest)
1
0
1
repeated

instead of brain there is eel

mom found the pleroma-tan dakimakura darkness
2
4
15
repeated
cover of the estonian children's song "Meil aiaäärne tänavas", made from 90s tracker song samples, rendered with amiga soundboard emulation. Original notation that it's based on, collected by Aleksander Säbelmann-Kunileid on his travels, 1872
3
5
3
repeated
Fumo day
Fumo time
0
3
6
Show older