Live data from Hacker News

The Linux codebase has over 3k TODO comments, many from over a decade ago

todos.tickgit.com

91–100 of 301 posts

Re: The Linux codebase has over 3k TODO comments, many from over a decade ago

#91

I use TODO in my code all the time as shorthand for: "This code is functional, but if you are going to do another iteration you may want to consider the following improvement or optimization." It's not at all meant to be to be like an item in a TODO list. Code would be a terrible place to keep that.

Use IMPROVEME instead of FIXME ;)

TODO, FIXME and XXX are built into tools already. Sure you can make new stuff up but it makes it harder to find later.

Re: The Linux codebase has over 3k TODO comments, many from over a decade ago

#92
post #59

Earlier quoted context omitted.

Sure, for the individual. Does the project track them internally? How are they followed up on? How is work assigned and prioritized?

When the file is next edited by the next individual. They don't need to be tracked

Sure, and then you end up with linux.

Re: The Linux codebase has over 3k TODO comments, many from over a decade ago

#93
post #53

Earlier quoted context omitted.

What's the advantage of throwing away context that could be useful in the future? I've taken ownership of codebases with technical debt before, and when modifying the code for something time-sensitive, I often annotate issues with the code whose solutions (usually refactoring) can't be fit into the timeline of the current project. I (or others) can then take advantage of these annotations when I have time to dedicate…

You don't throw it away, you put it in the issue tracker where it can be prioritized, tracked and categorized. If it's not worth of the issue tracker, it shouldn't be worth of a TODO either.

Coupling it to the code that it affects is nice. If the commit never makes it into master a TODO doesn't either. If the function it's in gets rewritten, the TODO goes away. etc.

Re: The Linux codebase has over 3k TODO comments, many from over a decade ago

#94
post #59

Earlier quoted context omitted.

When the file is next edited by the next individual. They don't need to be tracked

Sure, and then you end up with linux.

...which is happily used by millions (billions if you include android) getting their work (and play) done in the meantime.

Re: The Linux codebase has over 3k TODO comments, many from over a decade ago

#95
post #8

Earlier quoted context omitted.

Correct me if I'm wrong but I use "FIXME" for this intent. I keep TODO for stuff actually left to implement.

Is there a standard for valid flags? I recently recommended a client use `TODOSECURITY` for todos which had security implications until fixed - I discovered functionality which was implemented before authorisation had been developed, resulting in a codepath which was unintentionally reachable by standard users. Seemed weird to make up a codeword but I wasn't aware of any standard convention, and visually highlighting…

I’d strongly recommend not landing code that has known security problems.

Re: The Linux codebase has over 3k TODO comments, many from over a decade ago

#96

I use this pattern across my codebase for the "critical functionality missing" scenario: #if DEBUG #define TODO(msg) #else #define TODO(msg) #error msg #endif Works like a charm. I've got another PRERELEASE() macro that lets you do an unofficial preview build, but would break an official stable release.

Slight tweak:

    #if DEBUG
    #define TODO(msg) #warning msg
    #else
    #define TODO(msg) #error msg
    #endif

Re: The Linux codebase has over 3k TODO comments, many from over a decade ago

#97
I always write TODO statements with a number from 1 to 4, indicating the severity.

1 is immediate, meaning it needs to be fixed for the system to work.

2 is something that should be done before release.

3 is a near term wish list sort of thing, and

4 is a hopeful, probably never sort of thing

In addition, another place I deviate from the norm is when I comment out code, I write the reason why it's commented out.

These two things really help keep my code from becoming incomprehensible as time passes.

Re: The Linux codebase has over 3k TODO comments, many from over a decade ago

#98

I use this pattern across my codebase for the "critical functionality missing" scenario: #if DEBUG #define TODO(msg) #else #define TODO(msg) #error msg #endif Works like a charm. I've got another PRERELEASE() macro that lets you do an unofficial preview build, but would break an official stable release.

Nice! Isn't this exactly assert in C++? (the following is from https://en.cppreference.com/w/cpp/error/assert)

    #ifdef NDEBUG
    #define assert(condition) ((void)0)
    #else
    #define assert(condition) /*implementation defined*/
    #endif

    ...
    assert(("There are five lights", 2 + 2 == 5));
    ...

    test: test.cc:10: int main(): Assertion `((void)"There are five lights", 2+2==5)' failed.
Take it as a token that you are doing something right. :)

Re: The Linux codebase has over 3k TODO comments, many from over a decade ago

#100

I use TODO in my code all the time as shorthand for: "This code is functional, but if you are going to do another iteration you may want to consider the following improvement or optimization." It's not at all meant to be to be like an item in a TODO list. Code would be a terrible place to keep that.

The lead programmer at my very first coding job taught me to put a string of at least three hash marks in a comment, to denote “this is a thing which is okay during development but absolutely must be changed/fixed before shipping this product”.

The more essential the change/fix, the more hashes. Made it really easy to do a global search for them, and you could easily filter the results to only show the most important ones by searching for longer strings of hashes.

Twenty years later and I’m still doing that in my personal projects.

Post reply on HN