News for hackers. Stuff that matters.
Re:Rob Pike: Dennis Ritchie has died by bootload on Wednesday October 12, 2011 @09:54PM (#3105667)

    #include <stdio.h> 
    main()
    {
        printf("goodbye, world\n");
    }
Re:Rob Pike: Dennis Ritchie has died by pjscott on Wednesday October 12, 2011 @10:55PM (#3105847)
Considering the tragic nature of the situation, the exit status should be nonzero.

    #include <stdio.h>
    
    int main(void) {
        printf("goodbye, world\n");
        return 1;
    }
Re:Rob Pike: Dennis Ritchie has died by phillco on Wednesday October 12, 2011 @11:48PM (#3105978)
What if he died peacefully?

    return 0;
Re:Rob Pike: Dennis Ritchie has died by pjscott on Thursday October 13, 2011 @01:02AM (#3106165)
Dying peacefully is still dying.

    return 1;
Re:Rob Pike: Dennis Ritchie has died by gamache on Thursday October 13, 2011 @07:27AM (#3106853)
All things die, and I consider him successful.

  return 0;
Re:Rob Pike: Dennis Ritchie has died by bootload on Wednesday October 12, 2011 @11:47PM (#3105976)
"... the exit status should be nonzero. .."

true but it's from P7, "C progamming language", pure K&R.

Re:Rob Pike: Dennis Ritchie has died by edoloughlin on Thursday October 13, 2011 @04:20AM (#3106579)
Style considerations in the other replies aside, this had the same hit-you-in-the-chest impact on me as the Jobs' logo. Kudos.
Re:Rob Pike: Dennis Ritchie has died by CamperBob on Wednesday October 12, 2011 @11:14PM (#3105897)
You mean:

   #include <stdio.h>
   
   main() {
      printf("goodbye, world\n");
   }
Re:Rob Pike: Dennis Ritchie has died by zmitri on Wednesday October 12, 2011 @11:28PM (#3105933)
It's true, he preferred the brackets formatted this way.
Re:Rob Pike: Dennis Ritchie has died by buddydvd on Thursday October 13, 2011 @02:11AM (#3106327)
For functions declarations, K&R style says braces open on new lines.

http://en.m.wikipedia.org/wiki/Indent_style

Re:Rob Pike: Dennis Ritchie has died by nikcub on Thursday October 13, 2011 @01:11AM (#3106189)
it is a sure-fire way to distinguish between developers who learnt to code a while ago from K&R and those who didn't.

I can't stand looking at braces on new lines. It is all from back when a new line was something to be treasured as displays were bad.

Re:Rob Pike: Dennis Ritchie has died by msl on Thursday October 13, 2011 @02:21AM (#3106349)
Actually, my copy of the second edition K&R seems to have the opening brackets on new lines when it comes to function declarations, so:

main () {

but: while (){ and: if(){

I don't have a copy of the first edition at hand but I seem to remember that it uses this same style.

//msl

Re:Rob Pike: Dennis Ritchie has died by vsrinivas on Thursday October 13, 2011 @01:11PM (#3107895)
The first edition has opening brackets for functions on a new line. It also used a space before parenthesis for while loops and conditionals. Return types, when required, were on the same line as a function name.
Re:Rob Pike: Dennis Ritchie has died by ajays on Thursday October 13, 2011 @02:02AM (#3106301)
Exactly. On a 24-line VT100 display, you bet that every line was important!
Re:Rob Pike: Dennis Ritchie has died by sgerrand on Thursday October 13, 2011 @03:53PM (#3108514)
As should we all.