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.
"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.
To what end? Is vertical space at some kind of premium? I have a scroll bar.
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.
Agreed. Besides crappy formatting, he also makes his programs do confusing things. Why does the first example run in the infinite loop?
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)."
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.
Maybe there's a point in there somewhere, but bad code samples distract from it.