News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

What is the term?

Started by Strobe Raver, August 10, 2009, 08:05:11 PM

Previous topic - Next topic

Strobe Raver

I can't think of the keyword for this situation:

If the variable is a dword, put a "dw" infront.
If the variable is a pointer to a zero-terminated string, put a "sz" infront.


:dazzled:

Slugsnack

hungarian notation. also, pointer to zero terminated string would be lpsz

Strobe Raver

Quote from: Slugsnack on August 10, 2009, 08:06:11 PM
hungarian notation. also, pointer to zero terminated string would be lpsz

Thank you very much. You are smart  :cheekygreen:

dedndave

lp stands for long pointer, i think
someplace, i saw a post that had a link to a list of these - wish i had bookmarked that one

dedndave

here we go...
http://msdn.microsoft.com/en-us/library/aa260976(VS.60).aspx

also, the wikipedia page always has a nice list of references and links at the bottom
http://en.wikipedia.org/wiki/Hungarian_notation

Astro

haha - they're now suggesting the use of Hungarian notation is bad.

Do whatever you want as long as it is documented if more than just you will be reading the code, and be consistent.

Best regards,
Astro.

Slugsnack

hungarian notation is pointless in strongly typed languages. it's ideal for languages like asm though. one of its greatest assets IMO is that it saves thinking up variable names ( which i suck at ). for that same reason i think anonymous labels are a godsend haha

Astro

I use prefixes like 'h' for Handle, 'ptr' for a pointer, 'str' for a string if I'm desperate, but otherwise prefer the use of descriptive variable names such as HandleToHeap (abbreviated to hHeap) and NumberOfDevices (numdevs).

You could argue I'm inconsistent with capitialization but it is easier to type if it is all lowercase.

Can't beat comments in the code though.

Best regards,
Astro.

Slugsnack

well you've developed your own sort of notation. but surely it's better to use one that everyone else recognises so they can all read your code easily as well ?

Astro

From what I read recently, it seems that people struggle with it, it loses meaning over time, etc..

I think anything that anyone uses is prone to mis-understanding at some point, so comment away is probably the best solution.

; Calculate and allocate memory for the structure so SomeFunc can populate it with data from the USB

More informative IMHO than just:

mov ebx,NumDevs
mov eax,70h
mul ebx
push eax
push 8h
push hHeap
call HeapAlloc
mov hStruct,eax


Best regards,
Astro.

dedndave

the good part about hungarian notation is, it makes it easier to read msdn api reference - lol
after a while, you get used to it, and start using it in your own code