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

A few more comments? #3

Open
Etenil opened this issue Nov 20, 2013 · 2 comments
Open

A few more comments? #3

Etenil opened this issue Nov 20, 2013 · 2 comments

Comments

@Etenil
Copy link

Etenil commented Nov 20, 2013

Although Rust is pretty readable to a newcomer, some of the code is quite obscure, particularly in uefi.mod. For example:

((*(*self).output).OutputString)(self.output, str);

A few comments to explain what those do would help.

@eddyb
Copy link

eddyb commented Nov 20, 2013

Is that necessary? If one can do self.output somewhere, (*self).output shouldn't be required, and Console could be rewritten to use &'static instead of raw pointers, but that wouldn't work because OutputString takes a raw pointer.
Hmm... SimpleTextOutput could be implemented by *EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL, making the code a little cleaner, but now I'm just nitpicking.

@eholk
Copy link
Owner

eholk commented Nov 20, 2013

I thought about using &'static instead of * for the EFI stuff, but I'm not sure I have a good reason to prefer one way or the other. The code will probably be cleaner with &'static, but it might be unsafer... It probably doesn't really matter, if you can't trust the UEFI code to do what it says then you probably have no hope of doing anything safely.

As far as comments, a lot of the stuff like the ((*(*self).output).OutputString)(self.output, str) is meant to be hidden in the library, so I'm not as worried about this being quite so ugly (although breaking it into multiple lines with variables holding the intermediate results might help). At the very least, we should add doc comments though.

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

3 participants