OdysseyDecomp icon indicating copy to clipboard operation
OdysseyDecomp copied to clipboard

Custom linter: Add requirement for `_OFFSET` variable names to be lowercase

Open MonsterDruide1 opened this issue 1 year ago • 3 comments

Example: _1d8, _c8, ...

Reason for this is that Begins with underscore and uppercase letter are technically reserved by the C++ spec and should not be used for own variable names. _C throws an error in some compilers, while _c does not - thus, we should use the latter, to improve compatibility with different systems.

Source: https://devblogs.microsoft.com/oldnewthing/20230109-00/?p=107685

MonsterDruide1 avatar Sep 29 '24 23:09 MonsterDruide1

What about the difference between field_xxx and _xxx? HexRaysPyTools generates field_xxx (and the fork I use adds the generated type into the name, like char_xxx) while the built-in struct creator uses _xxx. I'm far more in favor of field_xxx for the record.

GRAnimated avatar Sep 30 '24 00:09 GRAnimated

Isn't "field" already just implied by the _xxx scheme?

ThePixelGamer avatar Sep 30 '24 03:09 ThePixelGamer

That's also what I'm thinking. It does not add information/value, just make the name longer, and one advantage of having a very short name for these placeholders is that they stick out from proper namings, are immediately apparent that they do not have their final name yet and thus need to be adjusted.

MonsterDruide1 avatar Sep 30 '24 10:09 MonsterDruide1