Replies: 2 comments
-
|
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have been reading the source code of the decompiler for a little over a month now, and too often I need to format it in order to read it.
First problem: Indentation
Here is a sample block of code taken from action.cc#L323, screenshot to show tabs/spaces
Apart from mixing tabs with spaces, they don't even match each other. Not just these specific lines in this particular file, this inconsistency shows up basically everywhere in the code.
Second problem: Spaces
I guess this kind of formatting is intended as it is consistent across the whole code base, but it is just extremely hard to read and makes a great way to obfuscate the code.
With added spaces, it's now a whole lot easier to read:
Third problem: Function definitions
I wonder what was the motivation for the decision to add a blank line between the function definition and the curly braces (function body)?
This is not hard to read, by any means, but it is also not the standard at all for any coding convention that I'm aware of. And it's also inconsistent, for example: printc.cc#L2498 doesn't have a blank line in between.
Fourth problem: Using std:: in headers
Take a look at this crazy amount of
using std::
in error.hh#L38.Although as of now they're all put inside the
ghidra
namespace meaning they're not as much of a problem, butusing std::
in headers is still considered a bad practice, especially in this case where other files depend on this to "using" for them.Suggestion
Why don't we follow a standard coding style convention like Google C++ Style Guide, and use a code formatter?
Beta Was this translation helpful? Give feedback.
All reactions