You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code quality / readability varies quite a bit throughout the xGDBvm codebase: we have everything from neatly organized code to quite-messy-held-together-by-duct-tape code and everything in between. In some cases, the indentation (or lack thereof) of the code makes it extremely difficult for the reader to understand.
Of course, we don't have the time or resources to go through and fix this comprehensively, but it may be a good idea whenever fixing bugs or adding new features to cleanup the relevant code, if needed. It may be a single code block, it may be an entire function, or maybe an entire file, depending on the scope of the bugfix/feature and the amount of time available.
Coding style involves a lot of stylistic/cosmetic decisions about brace placement, presence of whitespace around parentheses and commas, and so on. Most of these decisions are trivial in my opinion and have little effect on readability of code.
The one thing that DOES have a HUGE effect on readability is indentation. Inconsistent indentation doesn't just make the code hard to read, it can even suggest logical structure in the code that isn't really there, which takes extra work to comprehend.
I think a few simple guidelines would go a LONG way to improving the code. Again, this isn't something we need to implement with sweeping changes, but piecemeal as we are able.
Indentation should reflect logical flow/organization of the code. All of the following introduce logical structure into the program which should be reflected by indentation.
function definitions
conditionals (if statements)
loops (for, while, do)
All commands within a particular code block should have identical indentation.
Four white spaces is the preferred unit of indentation.
Two white spaces or a tab character are also common conventions.
It's less important which unit of indentation is used than it is to simply be consistent!
The text was updated successfully, but these errors were encountered:
This is a common issue in software development. There is no need to invent new conventions.
For example, Linux has the "indent" command to address some of these issues for C.
The code quality / readability varies quite a bit throughout the xGDBvm codebase: we have everything from neatly organized code to quite-messy-held-together-by-duct-tape code and everything in between. In some cases, the indentation (or lack thereof) of the code makes it extremely difficult for the reader to understand.
Of course, we don't have the time or resources to go through and fix this comprehensively, but it may be a good idea whenever fixing bugs or adding new features to cleanup the relevant code, if needed. It may be a single code block, it may be an entire function, or maybe an entire file, depending on the scope of the bugfix/feature and the amount of time available.
Coding style involves a lot of stylistic/cosmetic decisions about brace placement, presence of whitespace around parentheses and commas, and so on. Most of these decisions are trivial in my opinion and have little effect on readability of code.
The one thing that DOES have a HUGE effect on readability is indentation. Inconsistent indentation doesn't just make the code hard to read, it can even suggest logical structure in the code that isn't really there, which takes extra work to comprehend.
I think a few simple guidelines would go a LONG way to improving the code. Again, this isn't something we need to implement with sweeping changes, but piecemeal as we are able.
The text was updated successfully, but these errors were encountered: