Live data from Hacker News

Viewing profile — thradams

thradams

HN member
Joined
Tue, Sep 13, 2022, 11:46 AM UTC
HN karma
218
Public activity
60 items

About thradams

No profile information was provided.

Recent public activity

  1. comment
    Comment #46279181

    In this model, ownership is checked statically when variables go out of scope and before assignment. "Owner pointers" must be uninitialized or null at the end of their scope. Basic…

  2. story
  3. comment
    Comment #41760005

    When exploring the design of nullable pointers in C and comparing them with other languages like C# and TypeScript, which have constructors, I realized that C might benefit from a …

  4. story
  5. comment
    Comment #41198102

    A two-minute video explaining the concepts of nullable pointers and pointer ownership in Cake, using a simple example.

  6. story
  7. comment
  8. story
  9. comment
    Comment #40192396

    Cake is a open source compiler and static analyzer in development. (Not production quality yet.) This video shows how cake can help programmers to create safe code just fixing warn…

  10. story
  11. comment
    Comment #39542666

    I think at "Keep the language small and simple" it should say avoid "two ways of doing something" ( The sample I have is 0, NULL and nullptr where nullptr is something new. Two way…

  12. comment
    Comment #39470139

    Cake disabled checks in a few linked list functions like pop_front pop_back.

  13. comment
    Comment #39459437

    Cake is not porting Rust semantics. It works on classical C code, like the first sample using fopen. #include #include int main() { FILE *owner f = fopen("file.txt", "r"); if (f) f…

  14. comment
    Comment #39445784

    (question about rust.. this is not implemented in cake yet) Let's say I have to objects on the heap. A and B. A have a "view" to B. Then we put a prompt for the user. (or dynamic c…

  15. comment
    Comment #39444614

    The ownership checks are new in Cake, less than one year. So the answer is no, just cake is using. And there is a lot of work to do..in flow analysis etc. The cake source itself is…

  16. comment
    Comment #39443129

    (I think preprocessor is the place where memory is used and released all the time while expanding macros.)

  17. comment
    Comment #39441533

    This "dynamic drop semantics" does not exist in cake. int * owner p = malloc(sizeof(int)); if (condition) free(p); free(p); // error p may be initialized/moved. to fix int * owner …

  18. comment
    Comment #39440421

    auto, typeof, _Generic are implemented in cake. Sometimes when they are used inside macros the macros needs to be expanded. Then cake has #pragma expand MACRO. for this task. Sampl…

  19. comment
    Comment #39440268

    The idea is to keep cake aligned with C, not a language fork. But Cake itself could have a fork to Cake++. :D

  20. comment
    Comment #39440167

    (by the way, embed is not working on web version because of include directory bug - it is an open issue and regression)

  21. comment
    Comment #39440145

    Rust needs to add some runtime checks when calling destructors in scenarios where some object may or may not be moved. In C++ for instance, for smart pointers, the destructor will …

  22. comment
    Comment #39440108

    One issue I see with this approach (compiler leaking memory) is, for instance, if the requirements change and you need to utilize the compiler as a lib or service. For example, if …

  23. comment
    Comment #39440005

    In cake there is no temporal hole, we cannot reuse the deleted object. This prevents double free and use after free. int main() { struct X * owner p = malloc(sizeof(struct X)); p->…

  24. comment
    Comment #39439961

    Thanks for the rust sample. It looks very similar. Can the allocator be customized? As I said I am not Rust specialist. Also, in my understanding is that in Rust, sometimes a dynam…

  25. comment
    Comment #39439847

    Cake implements defer as an extension, where ownership and defer work together. The flow analysis must be prepared for defer. int * owner p = calloc(1, sizeof(int)); defer free(p);…