Live data from Hacker News

Viewing profile — btrask

btrask

HN member
Joined
Thu, Jan 20, 2011, 2:43 AM UTC
HN karma
1,914
Public activity
379 items

About btrask

https://bentrask.com - https://github.com/btrask

Recent public activity

  1. comment
    Comment #29296255

    I might be the last person to realize this, but did Microsoft name it .NET because they already had COM?

  2. comment
    Comment #28943756

    This article does not undermine its own point. In fact, very, very few articles ever undermine their own point. In order to undermine your own point it means you've failed to const…

  3. comment
    Comment #26186441

    I didn't like Regehr's proposal because I don't want a friendly dialect of C. I mostly just want C the way it worked up until, say, GCC 4.x. I don't know specifically how to fix th…

  4. comment
    Comment #26184169

    Or... the standard just has bugs which could be fixed. Bugs meaning: being out of line with the history of C and large amounts of C code in the wild. The more people beat the stand…

  5. story
  6. comment
    Comment #25526192

    Yeah, in C you need to use assertions (or simple checks) for things that might be null. That said the compiler isn't infinitely smart (thank god) and complex null derefs will "safe…

  7. comment
    Comment #25526115

    If you are transferring ownership, you would do p2 = p1; p1 = NULL; However if you are intentionally doing multiple ownership, then yes you can still have problems.

  8. comment
    Comment #25523684

    Green threads.

  9. comment
    Comment #25523651

    I see now, I misunderstood your original post. You were saying async/await is necessary because futures work badly, not because all the alternatives (i.e. locks) work badly. Sorry,…

  10. comment
    Comment #25523457

    Whether it's kernel threads or green threads, the same patterns (locks, etc) are possible. Locks are supposed to be the borrow checker's bread and butter, because it can guarantee …

  11. comment
    Comment #25523372

    Wait, what? What happened to "fearless concurrency"? I thought this was supposed to be one of the borrow checker's selling points! https://blog.rust-lang.org/2015/04/10/Fearless-Co…

  12. comment
    Comment #25508442

    So over the last thousand years salt has been a hyper-inflationary asset, and you're trying to tell me I'm rich for owning some?

  13. comment
    Comment #25422971

    This article is such a great opportunity for introspection ("what do we need in order to do better?"). It's too bad that the top comment has turned it into an opportunity for egoti…

  14. comment
    Comment #25204268

    Very reasonable! Thank you for the discussion :)

  15. comment
    Comment #25185128

    Taking a pointer-to-pointer is intentional to make it clear that the pointer will be modified. That's actually the most important difference from nn3's version IMHO.

  16. comment
    Comment #25184924

    Good points, thank you for explaining! I can see an argument for wrapping it in a macro so you can turn off nulling in debug builds (ASan might even have hooks so you can automate …

  17. comment
    Comment #25184598

    I tried making it a plain function at one point but ran into some weirdness around using void * * with certain arguments (const buffers?). You don't want to accept plain void * bec…

  18. comment
    Comment #25182721

    do {} while(0) is a common idiom for macros in C, because it consumes the trailing semicolon, which a bare {} block doesn't do. if(x) MACRO(); else something(); expands to if(x) { …

  19. comment
    Comment #25181382

    I appreciate you defending me, but I don't think he was trying to be dishonest.

  20. comment
    Comment #25181319

    I don't think that's fair in this case because nulling out pointers isn't the first line of defense. If you forget to do it once, it's not going to cause a bug in and of itself. Yo…

  21. comment
    Comment #25181232

    Help me out here, because I'm really trying to understand. Are you saying that dangling pointers that blow up if you double-free them is an "automatic check"? If not, what kind of …

  22. comment
    Comment #25180025

    In C you can use [0] for postfix pointer dereferencing.

  23. comment
    Comment #25179563

    Here's the actual macro I (sometimes) use: #define FREE(ptrptr) do { \ __typeof__(ptrptr) const __x = (ptrptr); \ free(*__x); *__x = NULL; \ } while(0) There might be a better way …

  24. comment
    Comment #25179467

    Every problem can be solved in many different ways. If you think you've already got use-after-free bugs under control, then more power to you! You absolutely have to concentrate yo…

  25. comment
    Comment #25179177

    All code is full of vulnerabilites. If you say your code isn't, then I'm sure it is. I just do the best I can to keep the error rate as low as possible. But it's a rate, and it's n…