Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I regard every cast as a bug in my own code and try to refactor it so there aren't any. I can't get rid of all of them, but they're always worth a second look.

I don't normally grep for them, but others have told me they did.

P.S. one thing about D is you can do things like this:

    ubyte b = i;            // error, losing bits
    ubyte b = cast(ubyte)i; // ugly cast
    ubyte b = i & 0xFF;     // no cast, no error!
It's just one of the nice little details that making programming in D a pleasure.


These things are better checked automatically with a static linter, that presumably already has a full parser and AST representation of the language and knows what is a cast and not.

Nobody should keep a checklist of "100 things to grep for when doing a code review".




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: