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

Software pushups

Name: Anonymous 2014-11-24 23:01

Let's exercise together, /prog/!

1) Write a subroutine that accepts an array of unsigned ints and returns 4. It must operate on the array in-place and partition it so that all nonzero values are at the beginning of the array, and all zero values are moved to the end. For example, the input [0, 2, 0, 0, 4, 1, 4, 5] could be changed to [2, 4, 1, 4, 5, 0, 0, 0]. The relative order of the nonzero values is unimportant.

Name: Cudder !MhMRSATORI 2014-11-29 16:41

>>54
[For instance] compilers generate better assembly code [than programmers do].
No they bloody well don't. This stupid myth has to die. It's all just wishful thinking. Ditto for those ultra-high-level languages being more performant than C "because their compilers can do more optimisation" - keep dreaming. Maybe the hoards of incompetents that CS educations are shitting out these days can't program anymore, but that's a different issue... or perhaps it's intentional: if you make programmers stupid enough that almost all of them don't know Asm anymore, or if they do it's only from looking at the god-awful shit that compilers emit, then they certainly can't generate code better than a compiler because they've never seen anything better! A disgusting self-fulfilling prophecy.

As for the rest of that link... WTF. It's like that guy is seriously stoned.

>>55
Have you seen any real compiler output? And 420 cycles in 1 byte is better than 420 cycles and 1680 bytes.

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