Author: Tony Werten
Date: 21:49:30 03/04/04
Go up one level in this thread
On March 04, 2004 at 21:26:18, Omid David Tabibi wrote: >Lately as I'm spending more time in Windows programming, I'm considering the use >of Hungarian Notation for coding. There are various "dialects" of Hungarian >Notation, but the "standard" one seems to be the one appearing at the beginning >of Charles Petzold's "Programming Windows" book: > >Prefix Data Type > >c char or WCHAR or TCHAR >by BYTE (unsigned char) >n short >i int >x, y int used as x-coordinate or y-coordinate >cx, cy int used as x or y length; c stands for "count" >b or f BOOL (int); f stands for "flag" >w WORD (unsigned short) >l LONG (long) >dw DWORD (unsigned long) >fn function >s string >sz string terminated by 0 character >h handle >p pointer > >It seems that quite a mess is going on with integer types here: > >Integers > signed unsigned >char c by >short n w >int i ? >long l dw > >"w" standing for "word" used for 16 bit variables, which are no longer a word. >Same problem with long. And hell will break loose if you decide to change a >variable from char to unsigned char; you have to rename all the instances of the >variable from cVar to byVar! > >For strings, we have: > >s string >sz string terminated by 0 character > >I'm confused here. Do we have strings not-terminated by 0?! > > >But on the other hand, Hungarian Notation can make the code much clearer. Maybe >a simplified notation would be better however (e.g., n for integers, s for >strings, b for bool, f for floats, etc). > >What do you think about Hungarian Notation? > >I noticed in Gerbil's source code that Bruce Moreland uses his own dialect of >Hungarian Notation. Does any other chess programmer use it also? Personally I only use it for global variables, since location of use and location of declaration can be quite far away. In functions I see no use, since it's easy to find the declaration anyway and the notation looks "messy". That is of coarse if you use that other coding rule that functions and procedures shouldn't be longer than 1 page. BTW Pascal style (short)strings can be without a zero termination character. The length is put at string[0], so no need for that. Tony
This page took 0.01 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.