GithubHelp home page GithubHelp logo

lfc's People

Contributors

a-lafrance avatar

Stargazers

 avatar  avatar

Watchers

 avatar

lfc's Issues

More null pointer checks please

In most cases, pointer arguments can't be null pointers; there really aren't enough checks for this right now. This brings up two good ideas:

  1. The actual idea, verifying that pointers aren't null
  2. Creating a more sophisticated panic system to support this, like a panic_if macro for checking preconditions or something.

Linux as a platform may or may not work

Pretty much what the title says. I have yet to actually build on Linux (or any non-macOS platform) locally, so I have no firm proof that it works. On the other hand, CI refused to work on Linux, so that's not a good sign.

Can destructor parameters ergonomically free data pointers themselves?

Like, take a linked list for example: say I have a list_t of str_t, all of which must be dynamically allocated for lifetime reasons. When calling ll_free() to free the contents of the linked list, you might try to pass the str_free() destructor so that the contents of each string are freed. The problem with this is that it fails to free the str_t allocations themselves, so you end up with a memory leak because of the constraints of list_t not owning its data.

My best proposal for resolving this is, rather than forbidding non-dynamically allocated data in cases like these, pass some kind of boolean flag around when freeing so that you can specify whether or not the individual data pointers must be freed when freeing the overall data structure. In Rust-like terms, you would be specifying whether or not the data structure owns the data allocations -- if so, the destructor must make those deallocations itself, but if not nothing needs to be done.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.