News for hackers. Stuff that matters.
Re:Why your first Rust FizzBuzz implementation may not work by Robadob on Monday October 13, 2014 @07:53AM (#8448327)
I've always liked this c++ implementation of FizzBuzz, its not the most clear or logical but its short;

    const char* outs[] = { "%d\n", "Fizz\n", "Buzz\n", "FizzBuzz\n" };
    for (int i = 1; i < 101; i++)
        printf(outs[((((i%5)==0)<<1)+((i%3)==0))], i);
Re:Why your first Rust FizzBuzz implementation may not work by heinrich5991 on Monday October 13, 2014 @08:04AM (#8448355)
Is that allowed by the standard? (Passing a parameter to `printf` but not referencing it, in the non-"%d\n" case?)
Re:Why your first Rust FizzBuzz implementation may not work by kps on Monday October 13, 2014 @11:39AM (#8449122)
C11 §7.21.6.1

  If the format is exhausted while arguments remain, the excess
  arguments are evaluated (as always) but are otherwise ignored.
but that's just a consequence of stdarg, which does not require all supplied arguments to be consumed.