Git Product home page Git Product logo

Comments (2)

rossberg avatar rossberg commented on September 25, 2024 2

The length is given by the module parameter. Both the caller and the callee of course need to be aware of the import signature of the module. There is no scenario in which one can reasonably call this function without knowing what the module imports are, both their number and their types. So a caller usually has to look up wasm_module_imports anyway.

The fact that a caller violating a function's contract can lead to undefined behaviour in the callee is standard situation in C. Duplicating information in the parameter list does not change that, it merely creates redundant work for both sides to provide/check it.

from wasm-c-api.

peterhuene avatar peterhuene commented on September 25, 2024

That's a fair expectation (namely that the imports would need to be resolved anyway prior to instantiation), so it's unlikely that there would be a mismatch in normal usage. And providing a length can't prevent undefined behavior anyway (correct length, incorrectly allocated array for example), so I agree it's redundant even if it doesn't initially appear so when examining the function signature.

I'll close this issue as won't fix. Thanks!

from wasm-c-api.

Related Issues (20)

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.