News for hackers. Stuff that matters.
Re:Ask HN: What's the worst piece of code you've ever seen? by joshschreuder on Sunday January 31, 2016 @05:43PM (#11008511)
I found a couple of amusing subreddits that covers this yesterday: https://www.reddit.com/r/badcode https://www.reddit.com/r/programminghorror

One of the top posts, the so-called Bogosort, made me laugh pretty hard, even though it's probably intentionally bad: https://imgur.com/kUizTX1

Re:Ask HN: What's the worst piece of code you've ever seen? by Gibbon1 on Sunday January 31, 2016 @01:40AM (#11005512)
This gem from today is pretty icky

  TEST_PACKET_T *xmt_buffer = (TEST_PACKET_T *) radio_drv_cntl->xmt_buffer;

  ...
  ...
  uint8_t msg_len = xmt_buffer->len;
  // Fill the payload with 'data'
  for(uint8_t indx=offsetof(TEST_PACKET_T, data); indx<msg_len-2; indx++)
    xmt_buffer->data[indx] = indx;
Re:Ask HN: What's the worst piece of code you've ever seen? by earthshout on Sunday January 31, 2016 @06:31AM (#11006082)
Not code so it doesn't count but a command.

Dos: "attrib," Will strip all attributes from all files in a directory. Very easy to run accidentally.

Has a partner though "dir," Show all files even hidden. Very berry handy.