1. Macros

------=_NextPart_000_000A_01BFB6AD.153D4E80
        charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

Hi all,

    Could someone be so kind as to give me the jist on macros? I see the =
macro functions quite often, but I've never found any docs or help for =
them.

Chris

------=_NextPart_000_000A_01BFB6AD.153D4E80
        charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Dwindows-1252" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans MS">Hi all,</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans MS">&nbsp;&nbsp;&nbsp; =
Could someone=20
be so kind as to give me the jist on macros? I see the macro functions =
quite=20
often, but I've never found any docs or help for them.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff face=3D"Comic Sans =

------=_NextPart_000_000A_01BFB6AD.153D4E80--

new topic     » topic index » view message » categorize

2. Re: Macros

On Fri, 5 May 2000 16:15:08 -0400, Chris Bensler <bensler at MAILOPS.COM>
wrote:

>Hi all,
>
>    Could someone be so kind as to give me the jist on macros? I see the
macro functions quite often, but I've never found any docs or help for them.
>
>Chris
>


  Chris: You didn't say which computer langauge that you are asking about.

  But in general a macro is a statement whose first part is read by a
  program ( compiler/translator ) and the program will substitue the
  second part of the macro in place of the first part of the macro.

  Each language expands the macro a little different way.

new topic     » goto parent     » topic index » view message » categorize

3. Re: Macros

Hlo Bernie,

>   Chris: You didn't say which computer langauge that you are asking about.
welll, this IS a Eu messages list. *SMILE*

>   But in general a macro is a statement whose first part is read by a
>   program ( compiler/translator ) and the program will substitue the
>   second part of the macro in place of the first part of the macro.
>
>   Each language expands the macro a little different way.
>
Would you elaborate? Give me a simple example maybe pls? An occasion when
this would be useful?

ThanX

Chris

new topic     » goto parent     » topic index » view message » categorize

4. Re: Macros

On Fri, 5 May 2000 16:59:33 -0400, Chris Bensler <bensler at MAILOPS.COM>
wrote:
>Would you elaborate? Give me a simple example maybe pls? An occasion when
>this would be useful?

Chris:


 This is a very simple example

 In the "C" language I could use a MACRO like this:

 #define MyMacroName(ExprA)         ( (ExprA) * 20 )

 Now in my progam I use this:

 answer = MyMacroName(7 + 10)
 answer = MyMacroName( 487 + 10/523 )

 Then the compiler will put this in my program.

 answer = 7 + 10 * 20
 answer = 487 + 10/523 * 20

 In other words the compiler looks at the preprocessor #define

 statement and knows that we want to substitute something for MyMacroName

 The compiler then takes whatever the programmer inserts in place of

 ExprA and substitues it into the right side of the macro where ever

 it sees the ExprA ( Note the parenthes are part of the MACRO and are NOT

 inserted in the substitution )

 Macros can be very complicated but they can save allot of typing

 and make it easier because you only have to change a MACRO in one place

 and the rest of your program will be change by recompiling.

 Bernie

new topic     » goto parent     » topic index » view message » categorize

5. Re: Macros

ThanX Bernie,

    That's good enough for me.

Chris

new topic     » goto parent     » topic index » view message » categorize

6. Re: Macros

From: Bernie Ryan>

>  #define MyMacroName(ExprA)         ( (ExprA) * 20 )
>
>  Now in my progam I use this:
>
>  answer = MyMacroName(7 + 10)
>  answer = MyMacroName( 487 + 10/523 )
>
>  Then the compiler will put this in my program.
>
>  answer = 7 + 10 * 20

wouldnt that be:
  answer = (7 + 10) * 20 ?

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu