Coder Social home page Coder Social logo

Comments (2)

TheDan64 avatar TheDan64 commented on June 14, 2024

This is a good point; there are a bunch of type annotations that don't really add value such as (non function) null pointers and struct initializers which type inference would do fine without:

let mut x: *mut MyStruct = 0 as *mut MyStruct;
let mut y: MyStruct = MyStruct { ... };

from c2rust.

TheDan64 avatar TheDan64 commented on June 14, 2024

@anp I've added a flag --reduce-type-annotations as of 14223c6 to the ast-importer which can be used for this purpose. Here is an example of local variables, some of which will have no explicit type annotation when the flag is passed:

int a;
int b = 0;
int c = foo();
struct MyStruct d = {0};
int *e = 0;

which becomes:

let mut a: libc::c_int = 0;
let mut b = 0i32;
let mut c = foo();
let mut d = MyStruct{i: 0i32,};
let mut e = 0 as *mut libc::c_int;

from c2rust.

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.