PCSX2 Documentation/Code Formatting Guidelines: Difference between revisions

no edit summary
(Created page with "Generally speaking the PCSX2 project does not make strict rules or guidelines on how code should be formatted. Either same-line or next-line brace formatting is allowed, and m...")
 
No edit summary
Line 3: Line 3:
## Topic 1: Do not use variable type prefixes!
## Topic 1: Do not use variable type prefixes!


Variable type prefixes are commonly known as [Hungarian Notation][1], and are the sort of variable names popularized by the `Win32API`. They look something like this is in ideal situations:
Variable type prefixes are commonly known as [http://en.wikipedia.org/wiki/Hungarian_notation Hungarian Notation], and are the sort of variable names popularized by the <code>Win32API</code>. They look something like this is in ideal situations:
```C++
<code>DWORD dwSomeDoubleWord;</code>
DWORD dwSomeDoubleWord;
 
````
... and look something more like this in practical situations involving real code:
... and look something more like this in practical situations involving real code:
```C++
 
wxChar* lpwstrOmgThisSucks;
<code>wxChar* lpwstrOmgThisSucks;</code>
```
 
Besides being obscenely ugly, this naming convention is totally impractical for modern programming via an IDE with autocomplete features. Coders using such tools want to do autocomplete by the subject of the variable's purpose, and are then automatically provisioned variable type information via tooltip, making the prefix neigh worthless. If I'm looking for the `MasterVolume` of a voice, I might think `VoiceVolumeMaster`, `MasterVolumeVoice`, or `VolumeVoiceMaster` and in fact I'll probably have no idea of it's a dword, word, int, or float value type. Any code using this naming convention will be changed to something more sensible.
Besides being obscenely ugly, this naming convention is totally impractical for modern programming via an IDE with autocomplete features. Coders using such tools want to do autocomplete by the subject of the variable's purpose, and are then automatically provisioned variable type information via tooltip, making the prefix neigh worthless. If I'm looking for the `MasterVolume` of a voice, I might think `VoiceVolumeMaster`, `MasterVolumeVoice`, or `VolumeVoiceMaster` and in fact I'll probably have no idea of it's a dword, word, int, or float value type. Any code using this naming convention will be changed to something more sensible.


ninja
782

edits