News:

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

Macro naming convention question

Started by MazeGen, June 20, 2005, 06:43:20 PM

Previous topic - Next topic

MazeGen

I'm just rebuilding my general macro libraries in order to make some easy-to-use and clear system. I'm also renaming some of them.
I'm wondering why some macros of other coders starts with prefixes like "@" or "$". I mean, for instance, @ArgRev and @ArgI, mentioned in masm32.hlp, or $Is... macro set by Four-F, or $lcase and $ucase by <idontrememberwhosorry>.
Are there any benefits of such prefixes or have those prefixes some special meanings?

Jeff

im guessing that people use '@' in the beginning because many of MASM's built in macros have that prefix.  then perhaps macros with the '$' prefix are generally used for string manipulating macros (i recall basic used '$' for denoting strings).  so i wouldnt think its a "convention" per se but rather a fairly common style.

MazeGen

Yeah, it is rather pseudo-convention :wink

You're right, those macros with "$" prefix have string arguments, with integer arguments, there is no prefix. I will follow this "convention" too.

But what do you mean by MASM built in macros? I've never heard about that...

hutch--

I tend to use a plain name for a statement form macro and use the trailing $ on string functions that return a value as it is convention for basic string functions. Its a tidy way of reusing the library procedures which are C style zero terminated string types in another way that leverages the experience of programmers who know how to write basic style string functions.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Jeff

Quote from: MazeGen on June 20, 2005, 07:44:04 PMBut what do you mean by MASM built in macros? I've never heard about that...
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vclrftopicalcross-referenceforsymbols.asp

actually they refer to them as symbols but i consider them "highly specialized" macros (others may think differently).  all of them are prefixed with an '@' im guessing because they wanted to distinguish from MASM's macros from others.  this must be why new students learning MASM are taught not to prefix symbols with '@' and others (like the underscore '_').

MazeGen

hutch--,
yeah, you have reminded me qbasic text commands, which I used 10 years ago :bg


Date$ - System date variable.
Time$ - System time variable.
Left$ - Allows selective plucking of a character string from the left.
Right$ - Allows selective plucking of a character string from the right.
Mid$ - Allows selective plucking of a character string from the centre.
Ucase$ - Converts target string to uppercase.
Lcase$ - Converts target string to lowercase.


Jeff,
I completely forgot about them, since I don't use them. Thanks for reminding me.