Hacker News new | ask | show | jobs
by cygx 4037 days ago
it looks quite disturbing without them

Remove the newline and it looks ok to me:

    int i = 42;
    do printf("hey\n");
    while (--i > 0);
Another possibility would be:

    int i = 42;
    do printf("hey\n");
        while (--i > 0);
2 comments

Oohh... this would be so good for the underhanded C contest! Just mix is up with the comments which make the `do` look like (assuming good actor) an accidentally wrapped comment.

    /* The following code does something, so here's the
    // explanations of what happens. And here's what we actually
    */ do
    printf("hey\n");
    
    /* And now just count down */
    while (some_check(--i));
Now spot that in a large file of real code!
Sneaky. Most syntax highlighting would make it stick out like a sore thumb, but still, sneaky.
Just looking ok is not the point. I would prefer a match between how it looks and what it does...
I agree, but I don't see that undermined here.