Sign in Join
Wiki copytemporary

Hungarian notation: what changed

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

OldNewLine
11Hungarian 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.
22
3-\
4-\
5-\
63[[Miscellaneous types:]]\
74
85 F Property Variable
96 T Type
107 P Type of pointer to another type
118 On Event
129
1310[[Basic types:]]\
1411
1512 b Boolean
1613 c Char
1714 s String
1815 d for all reals\floats as Double, Extended, ...
1916 i for all integers as Integer, Long Integer, Smallint, ...
2017 p Generic Pointer
2118 pz PChar
2219 ...\...
2320
2421[[Published name (controls):]]\
2522
2623 btn TButton; ex.: btnFoo1
2724 bbtn TBitmap Button
2825 optbtn TOption Button
2926 sbtn TSpeedButton
3027 chk TCheck Box
3128 cbx TComboBox
3229 db TDatabase
3330 dts TDataSource
3431 edt TEdit Box
3532 frm TForm
3633 grd TDrawGrid
3734 sgrd TString Grid
3835 dbgrd TDBGrid
3936 img Image
4037 itm TMenuItem
4138 lbl TLabel
4239 lbx TListbox2
4340 dblbx TDBListbox
4441 mnu TMainMenu
4542 pmnu TPopup Menu
4643 mem TMemo
4744 notbk TNotebook
4845 tabs TTabset
4946 tabnotbk Tabbed Notebook
5047 hdr THeader
5148 stb TStatusBar
5249 outl TOutline
5350 pnl TPanel
5451 tbl TTable
5552 qry TQuery
5653 timr Timer
5754 fld TField
5855 inif TIniFile
5956 ...\...
6057
6158[[Components \ Objects:]]
6259
6360 cmp TComponent
6461 oSL TStringList; ex.: oSLfoo
6562 oStrm TStream; ex.: oStrmFoo
6663 ...\...
6764
6865[[Miscellaneous notable scope:]]\
6966
7067 g means Global, wheras its type (simple or object)
7168
7269[[Memory scope management:]]\
7370
7471 o means, from a memory scope management, that oMyObj must be freed within the scope of its declaration; ex.: oMyObject; ex.: goMyObject
7572 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
7673
7774[[Constants:]]\
78-\
75+
7976Constants are often written in uppercase ( like in C):
8077
8178 const LF_WINDOWS = #13#10;
8279 const LF_LINUX = #10;
8380
8481Another notation could consist of mixing a lowercase c - for constant - followed by its basic type:
8582
8683 const ciIndex = 1;
8784 const csPathHome = '/home';
8885 const ccNull = #0
8986 ...\...
9087
9188---
9289*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