News for hackers. Stuff that matters.
Re:C to Go: Could Go replace C? by mkelly on Wednesday May 11, 2011 @02:40AM (#2535416)
Is this person intentionally trying to make the C harder to read? What's with all the missing newlines? I didn't get past the first few examples, because the C was so unnecessarily difficult to read, I assumed the Go was in similarly bad style. (I don't know Go.)

Maybe there's a point in there somewhere, but bad code samples distract from it.

Re:C to Go: Could Go replace C? by etaty on Wednesday May 11, 2011 @03:41AM (#2535558)
His formatting style is just the best way to get lost !

if(...) ...;ELSE {

}

That's the first time I see this and hope the last.

Re:C to Go: Could Go replace C? by dreeves on Wednesday May 11, 2011 @04:00AM (#2535594)
"We deviate from standard style for compactness."
Re:C to Go: Could Go replace C? by jeffreymcmanus on Wednesday May 11, 2011 @11:55AM (#2536917)
Compactness is not a very good reason to deviate from the standard style, particularly since in Go, the standard style can in some cases have an impact on the syntax of the code.
Re:C to Go: Could Go replace C? by mkelly on Wednesday May 11, 2011 @11:47PM (#2539404)
To what end? Is vertical space at some kind of premium? I have a scroll bar.
Re:C to Go: Could Go replace C? by barrkel on Wednesday May 11, 2011 @03:34AM (#2535536)
It seemed clear and fairly idiomatic to me, though it was clearly trying to reduce the line count. For maintainable code, I'd expect more newlines and a little more separation of assignments from comparisons, but not much more.

Intuitions like these are rough though - it depends on how low in your perception stack you have the C operators etc. embedded.

Re:C to Go: Could Go replace C? by k_kisiel on Wednesday May 11, 2011 @04:48AM (#2535692)
Agreed. Besides crappy formatting, he also makes his programs do confusing things. Why does the first example run in the infinite loop?
Re:C to Go: Could Go replace C? by philwelch on Wednesday May 11, 2011 @05:28AM (#2535758)
Because that's what the "yes" utility does:

"By itself, the yes command outputs 'y' or whatever is specified as an argument, followed by a newline repeatedly until stopped by the user or otherwise killed; when piped into a command, it will continue until the pipe breaks (i.e., the program completes its execution)."

http://en.wikipedia.org/wiki/Yes_(Unix)

Re:C to Go: Could Go replace C? by Lozzer on Wednesday May 11, 2011 @05:42AM (#2535784)
From the first line of the man page for yes:

yes - output a string repeatedly until killed

Re:C to Go: Could Go replace C? by maartenscholl on Wednesday May 11, 2011 @05:29AM (#2535759)
The first example is a basic implementation of the 'yes' unix shell utility.