Sign in Join
Wiki copytemporary

Hungarian notation: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: Hungarian notation

OldNewLine
1+Hungarian notation in a coding style adopted by MS for C development under Windows. This variable naming technique claims to harmonize, to improve the readability of the existing variables, so to save time. Here is an example list, neither official nor fixed (the prefixes are usually based on the information theory, which concludes that consonants can be inferred in the middle of vowels. It uses too, the Camel case notation a lot). The name refection tool is perfect to use this technique easily.
2+
3+\
4+\
5+\
6+[[Miscellaneous types:]]\
7+
8+ F Property Variable
9+ T Type
10+ P Type of pointer to another type
11+ On Event
12+
13+[[Basic types:]]\
14+
15+ b Boolean
16+ c Char
17+ s String
18+ d for all reals\floats as Double, Extended, ...
19+ i for all integers as Integer, Long Integer, Smallint, ...
20+ p Generic Pointer
21+ pz PChar
22+ ...\...
23+
24+[[Published name (controls):]]\
25+
26+ btn TButton; ex.: btnFoo1
27+ bbtn TBitmap Button
28+ optbtn TOption Button
29+ sbtn TSpeedButton
30+ chk TCheck Box
31+ cbx TComboBox
32+ db TDatabase
33+ dts TDataSource
34+ edt TEdit Box
35+ frm TForm
36+ grd TDrawGrid
37+ sgrd TString Grid
38+ dbgrd TDBGrid
39+ img Image
40+ itm TMenuItem
41+ lbl TLabel
42+ lbx TListbox2
43+ dblbx TDBListbox
44+ mnu TMainMenu
45+ pmnu TPopup Menu
46+ mem TMemo
47+ notbk TNotebook
48+ tabs TTabset
49+ tabnotbk Tabbed Notebook
50+ hdr THeader
51+ stb TStatusBar
52+ outl TOutline
53+ pnl TPanel
54+ tbl TTable
55+ qry TQuery
56+ timr Timer
57+ fld TField
58+ inif TIniFile
59+ ...\...
60+
61+[[Components \ Objects:]]
62+
63+ cmp TComponent
64+ oSL TStringList; ex.: oSLfoo
65+ oStrm TStream; ex.: oStrmFoo
66+ ...\...
67+
68+[[Miscellaneous notable scope:]]\
69+
70+ g means Global, wheras its type (simple or object)
71+
72+[[Memory scope management:]]\
73+
74+ o means, from a memory scope management, that oMyObj must be freed within the scope of its declaration; ex.: oMyObject; ex.: goMyObject
75+ o_ means, from a memory scope management, that o_myObj must not be freed here, i.e. must not be freed in the scope of its declaration, but elsewhere, in a remote scope, where there is an statement declaration of oMyObj, which is the one where this object was created!; ex: o_myObj
76+
77+[[Constants:]]\
78+\
79+Constants are often written in uppercase ( like in C):
80+
81+ const LF_WINDOWS = #13#10;
82+ const LF_LINUX = #10;
83+
84+Another notation could consist of mixing a lowercase c - for constant - followed by its basic type:
85+
86+ const ciIndex = 1;
87+ const csPathHome = '/home';
88+ const ccNull = #0
89+ ...\...
90+
91+---
92+*From the Free Pascal wiki, page "Hungarian notation", as it stood on 2020-11-12 after a change by Eric69, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history