Menu

#4 Clean up code, remove // comments

open
Misc. (4)
5
2008-05-05
2008-05-05
No

Need to add more comments in the less used portions of the code. ZCT could become the most well commented program really... Also, remove all the // comments, as they all are just hacky tweaks being tested out, not actual comments.

Discussion

  • Zachary Wegner

    Zachary Wegner - 2008-05-05
    • assigned_to: nobody --> zwegner
     
  • Dann Corbit

    Dann Corbit - 2008-05-06

    Logged In: YES
    user_id=263380
    Originator: NO

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <ctype.h>

    char string[65535];

    void change_comments(char *string)
    {
    char *where = strstr(string, "//");
    if (where) {
    where[1] = '*';
    where = strchr(string, '\n');
    if (where)
    *where = 0;
    strcat(string, " */\n");
    }
    }

    int main(void)
    {
    while (fgets(string, sizeof string, stdin)) {
    change_comments(string);
    fputs(string, stdout);
    }
    }

     
  • Zachary Wegner

    Zachary Wegner - 2008-05-06

    Logged In: YES
    user_id=2072047
    Originator: YES

    Hehe, thanks for the code Dann. I actually want to keep them as // comments (just to keep track of them), and delete what they are commenting out. Whenever a // comment is used, its not for a comment, but just commenting out some code. The idea is that wherever I've done that I need to clean up the code there. There are some verify()s I have //ed out too, maybe I should make a ZCT_VERIFY macro...

     

Log in to post a comment.

MongoDB Logo MongoDB