News for hackers. Stuff that matters.
Re:You did this with an AI and you do not understand what yo... by noosphr on Monday September 22, 2025 @11:11AM (#45334555)
Each punch card was it's own line of text.

By putting the final curly brace on it's own card, and hence line, it meant you could add lines to blocks without having to change the old last line.

E.g. the following code meant you only had to type a new card and insert it.

     for(i=0;i<10;i++){         /* Card 1 */
          printf("%d ", i);     /* Card 2 */
     }                          /* Card 3 */

     for(i=0;i<10;i++){         /* Card 1 */
          printf("%d ", i);     /* Card 2 */
          printf("%d\n", i*i);  /* Card 3 */
     }                          /* Card 4 */
But for following had to edit and replace an old card as well.

     for(i=0;i<10;i++){         /* Card 1 */
          printf("%d ", i);}    /* Card 2 */
     
     for(i=0;i<10;i++){         /* Card 1 */
          printf("%d ", i);     /* Card 2' */
          printf("%d\n", i*i);} /* Card 3 */
This saved a bit of typing and made errors less likely.
Re:You did this with an AI and you do not understand what yo... by jcranmer on Monday September 22, 2025 @12:43PM (#45335996)
I'm dubious of this explanation because C itself largely postdates punched cards as a major medium of data storage, and some quick searches doesn't produce any evidence of people using punch cards with C or Unix.
Re:You did this with an AI and you do not understand what yo... by noosphr on Monday September 22, 2025 @06:24PM (#45340366)
Ed was also line oriented.

Using regex to edit lines instead of typing them out was a step up, but not much of one.

Also my father definitely had C punch cards in the 80s.