Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Where is the letter 'm' for?

Status
Not open for further replies.

RedLion

Programmer
Sep 13, 2000
342
NL
In a lot examples you see that people use the letter m as an object:

m.something = 4
? m.something

returns 4 to the screen, and:

? something

also returns 4 to the screen, and in the debugger you can't see object m, only 'something'. So my question is what is the letter 'm', and where do you use it for?

Thanks,

Charl
 
The 'M.' means it's a memory variable.
So like FooBar = 1 and m.Foobar = 1 are the same thing.


From what I've seen it's a older programming style. BUt useful to know see at a glace Variable differances.

(please.. someone correct me if I'm wrong. =) )

Personally.. the only time I've used the M. in front of my vars is with a Global Var. and/or when FoxPro can't seem to figure out what Variable I'm useing in a statment.

---===///The PogoWolf\\\===---
Darkness..Bleakness..Plastic forks..?

 
The "m" does stand for memory variable and it is best used to deferentiate between a field name (i.e. CustID) and the memory variable you store the CustID in (i.e. m.CustID).

I think it was used a lot more in the old 2.x or previous days with the SCATTER/GATHER commands.

If this is not correct, someone please let me know.

Thax

 
Yes, this is correct, but it isn't just old procedure. If you have a variable with the same name as a field in a table, you MUST use the "m." prefix. For example, suppose you have a table with a field called "Ordernum" and a variable called "Ordernum". As long as the table is selected, any reference to "Ordernum" will use the field in the table and ignore the memory variable. To access the variable, you must reference "m.Ordernum" instead.
 
I'm glad you guys had this little discussion. I'm afraid I had the meaning of 'm.' just backwards in my mind. I thought it indicated something like 'my field'. Of course I just ignore the whole problem by making sure I differentiate fields from variables by something like putting an 'f' in front of a field name or a 'v' in front of the variable name, but now that I've got it straight, I'll make some code posted around here more readable.

Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top