Overview of variable naming conventions
Luboš Luňák
l.lunak at collabora.com
Sat Feb 26 17:48:40 UTC 2022
On Saturday 26 of February 2022, Jan Rheinlc3a4nder wrote:
> Hi,
>
> is there somewhere a key to naming variables? For example, I see
>
> OUString msDocAccTitle
> DocumentType meDocType
> std::unique_ptr<IGrammarContact> mpGrammarContact
> const OUString& rBuffer
> SmFormat maFormat
> OUString maAccText
> bool mbFormulaArranged
> sal_uInt16 mnSmSyntaxVersion
>
> So there is "ms" maybe meaning "member string"? "mb": "member bool"? But
> "ma" and "me" ?
It's called Hungarian notation
(https://en.wikipedia.org/wiki/Hungarian_notation). It's one of the obsolete
obnoxious things LibreOffice inherited from OpenOffice that keeps going on
because of inertia.
'm' is member, 'r' is reference, 'p' is pointer, 'x' is UNO reference, 'a' is
array (or string), 's' is string, 'e' is enum, 'n' is number, 'b' is bool. Or
maybe not, since in a number of variables it's wrong.
I personally consider 'm' to be the only one useful and the rest is garbage
that gets in the way and can be ignored.
--
Luboš Luňák
l.lunak at collabora.com
More information about the LibreOffice
mailing list