Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lots of magic numbers #16

Open
Akeboshiwind opened this issue Dec 29, 2019 · 1 comment
Open

Lots of magic numbers #16

Akeboshiwind opened this issue Dec 29, 2019 · 1 comment

Comments

@Akeboshiwind
Copy link
Contributor

It seems like c2rust has removed a lot of the named constants so we've ended up with a bunch of magic numbers which are a lot less readable.

A good example might dumpkmap which has the following on line 77:

write(
  1i32,
  bb_common_bufsiz1.as_mut_ptr() as *const libc::c_void,
  (7i32 + 256i32) as size_t,
);

Versus the busybox version:

write(
  STDOUT_FILENO,
  flags,
  7 + MAX_NR_KEYMAPS
);

If and when someone gets c2rust refactor going this might be something good to tackle.

@samuela
Copy link
Owner

samuela commented Jan 6, 2020

It's worth mentioning that there are also a bunch of constants that are "declared" but that are copied across many different files and modules. Ultimately these should be de-duped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants