Live data from Hacker News

Dennis Ritchie's first C compiler on Github

github.com

31–40 of 88 posts

Re: Dennis Ritchie's first C compiler on Github

#31
post #24

He already used the right brace style (hanging braces, cuddled else) and the right indentation (tabs, not spaces).

Somehow over the years learning C on my own, perhaps because it seemed more consistent to me, I got used to writing if(foo) { omitting the space after control statements' names, which is almost never done - except in very early C code. (It's not just this: V7 Unix often omits the space as well.). I should probably settle on a less idiosyncratic personal style, but I can't help but take a little heart from seeing "my"…

It was also defined in the Plan 9 code style: http://plan9.bell-labs.com/magic/man2html/6/style

"no white space after the keywords if, for, while, etc."

Re: Dennis Ritchie's first C compiler on Github

#32
post #28
post #24

Earlier quoted context omitted.

Somehow over the years learning C on my own, perhaps because it seemed more consistent to me, I got used to writing if(foo) { omitting the space after control statements' names, which is almost never done - except in very early C code. (It's not just this: V7 Unix often omits the space as well.). I should probably settle on a less idiosyncratic personal style, but I can't help but take a little heart from seeing "my"…

Never using a space before the paren is more consistent. I don't know why people put a space there...

I don't want my function calls to be consistent with control structures.

Re: Dennis Ritchie's first C compiler on Github

#34
post #28
post #24

Earlier quoted context omitted.

Somehow over the years learning C on my own, perhaps because it seemed more consistent to me, I got used to writing if(foo) { omitting the space after control statements' names, which is almost never done - except in very early C code. (It's not just this: V7 Unix often omits the space as well.). I should probably settle on a less idiosyncratic personal style, but I can't help but take a little heart from seeing "my"…

Never using a space before the paren is more consistent. I don't know why people put a space there...

That's the way you do it in normal text.

Re: Dennis Ritchie's first C compiler on Github

#35
post #24

Earlier quoted context omitted.

Somehow over the years learning C on my own, perhaps because it seemed more consistent to me, I got used to writing if(foo) { omitting the space after control statements' names, which is almost never done - except in very early C code. (It's not just this: V7 Unix often omits the space as well.). I should probably settle on a less idiosyncratic personal style, but I can't help but take a little heart from seeing "my"…

if(foo) I avoid doing this because it looks like a function call.

In an appropriately powerful language, it could be a function call.

Re: Dennis Ritchie's first C compiler on Github

#36
post #24

Earlier quoted context omitted.

Somehow over the years learning C on my own, perhaps because it seemed more consistent to me, I got used to writing if(foo) { omitting the space after control statements' names, which is almost never done - except in very early C code. (It's not just this: V7 Unix often omits the space as well.). I should probably settle on a less idiosyncratic personal style, but I can't help but take a little heart from seeing "my"…

if(foo) I avoid doing this because it looks like a function call.

[deleted]

Re: Dennis Ritchie's first C compiler on Github

#37
post #30

Earlier quoted context omitted.

> (Spoiler - We start with BCPL, then Move to B - it's left as an exercise to determine how we originally compiled BCPL) The first version of Go started with B: http://code.google.com/p/go/source/detail?r=f6182e5abf5e The second revision was converted to C: http://code.google.com/p/go/source/detail?name=f6182e5abf5e&... The third to Draft-Proposed ANSI C: http://code.google.com/p/go/source/detail?name=f6182e5abf5e&..…

Uh these commits seem interesting, but I don't quite understand the context. What's macho and what is its relation to go? Are the dates way off or is it an import of older history?

Your leg is being pulled, a little. Mach-o is the mach object file format, Brian Kernighan's C 'hello world' program is being used as source for, I think, a test. It's checked into the go tree with version history all the way back to its primordial source.

Re: Dennis Ritchie's first C compiler on Github

#39

He already used the right brace style (hanging braces, cuddled else) and the right indentation (tabs, not spaces).

Recently some ignorant, nescient C++ programmer called me a Java programmer, because I use K&R style and not his preferred Allman style. Even Stroustrup uses hanging braces (with the exception of function body opening braces)!
Post reply on HN