News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Opening Windows in x64 ASM/Windows API Calls

Started by Caljay, August 08, 2022, 05:55:20 AM

Previous topic - Next topic

TimoVJL

descriptive function and variable names are important too.
May the source be with you

jj2007

Quote from: TimoVJL on August 09, 2022, 06:11:50 PM
descriptive function and variable names are important too.

Right :thumbsup:

Though it's a matter of taste. I use some$ to indicate a string, and got eaten alive by a bunch of purists at the FreeBasic forum (where I am banned for life, hehe).

It's important to be consistent. Once upon a time there were languages that allowed 26 variables named A...Z :cool:

If you see fild MyR4 in some source, what do you think?

TimoVJL

Quote from: jj2007 on August 09, 2022, 06:39:28 PM
If you see fild MyR4 in some source, what do you think?
floating point variable, a float, real4 is something, that comes up my mind.
May the source be with you

jj2007

Quote from: TimoVJL on August 09, 2022, 07:26:36 PM
Quote from: jj2007 on August 09, 2022, 06:39:28 PM
If you see fild MyR4 in some source, what do you think?
floating point variable, a float, real4 is something, that comes up my mind.

Exactly. And that it will miserably fail with fild :biggrin:

It's all about readability and transparency. For demos, I always use My$, MyR4, MyDw etc, in order to distinguish my own variables from WinAPI constants and the like. Micros*t uses Hungarian notation, or kind of, but they sometimes overdo it.

NoCforMe

Well, since we're now on variable naming (a valid programming topic if there ever was one), I get to explain my naming convention.

Disclaimer: This is not meant as thou shalt use my naming scheme because it's teh best in the world and if you don't use it you're a big dummyhead. This is just the way I do things. Works for me. If it works for you, fine. If not, let me know how you do things; maybe it's better than my way.

I divide my variables into two groups, globals and locals. All my globals are capitalized: TextHeapPtr is a global. All my locals start with lowercase: loopCounter is a local. So I know right away whether a variable is global or local. (That way I know whether to use OFFSET or ADDR to get the address of the variable.)

I try to be descriptive in the name to identify what type of variable it is: xxxxPtr is a pointer, xxxxCount is a counter. Then there are obvious ones: xxxxHandle. Other than this, I don't really have a "system" for IDing the type (certainly nothing like Micro$oft's "Hungarian" notation, which I find to be complete overkill, but that's because they use C which requires strong typing, as opposed to our MASM32 world where practically everything is just a DWORD ...).

The other convention is for constants: I preface all my constants with $: $backgroundColor is a constant.

Works for me. What's your system? I think it's important to have a system, one that works for you.
Assembly language programming should be fun. That's why I do it.

mikeburr

noC4me.. i use the names of my old Girlfriends,, with slight redaction to avoid comprehensive legal action eg SandraHell..  unfortunately i get a lot of code that does its own thing regardless of what i thought it might like to do ..gives me a lot of unneccesary [IMHO] output and generally doesnt work very well
regards mikeb

hutch--

I prefer things to be descriptive along with some arbitrary notion that I choose to use.

.data
  text db "Howdy, I am text data",0
  ptxt dq text                               ; ptxt being the pointer

I rarely ever use the old hungarian notation "sz", a left over from the 1990 SDK, I tend to name text.

  FileName db "Filename.ext",0
  pFile dq FileName

There is no simple rule, if its readable and makes sense, that is all you need.

With LOCAL variables, I tend to keep them at 4 or 5 characters so they are easy to read and line up when formatted. I generally capitalise data types and structures but have no particular preference for naming apart from being descriptive where possible.

TimoVJL

some of programmers just can be like artistic, so how to rule them ?
May the source be with you

hutch--