PCSX2 Documentation/Code Formatting Guidelines: Difference between revisions

no edit summary
No edit summary
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 [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:
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 <nowiki>Win32API</nowiki>. They look something like this is in ideal situations:


  <nowiki>DWORD dwSomeDoubleWord;</nowiki>
  <nowiki>DWORD dwSomeDoubleWord;</nowiki>
Line 11: Line 11:
  <nowiki>wxChar* lpwstrOmgThisSucks;</nowiki>
  <nowiki>wxChar* lpwstrOmgThisSucks;</nowiki>


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 <code>MasterVolume</code> of a voice, I might think <code>VoiceVolumeMaster</code>, <code>MasterVolumeVoice</code>, or <code>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.


'''Just don't do it.''' '''''Ever.'''''
'''Just don't do it.''' '''''Ever.'''''
ninja
782

edits