1. Macros
- Posted by Chris Bensler <bensler at MAILOPS.COM> May 05, 2000
- 436 views
------=_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> </DIV> <DIV><FONT color=3D#0000ff face=3D"Comic Sans MS"> = 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> </DIV> <DIV><FONT color=3D#0000ff face=3D"Comic Sans = ------=_NextPart_000_000A_01BFB6AD.153D4E80--
2. Re: Macros
- Posted by Bernie Ryan <xotron at BUFFNET.NET> May 05, 2000
- 438 views
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.
3. Re: Macros
- Posted by Chris Bensler <bensler at MAILOPS.COM> May 05, 2000
- 420 views
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
4. Re: Macros
- Posted by Bernie Ryan <xotron at BUFFNET.NET> May 05, 2000
- 431 views
- Last edited May 06, 2000
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
5. Re: Macros
- Posted by Chris Bensler <bensler at MAILOPS.COM> May 05, 2000
- 410 views
- Last edited May 06, 2000
ThanX Bernie, That's good enough for me. Chris
6. Re: Macros
- Posted by =?iso-8859-2?B?qWtvZGE=?= <tone.skoda at SIOL.NET> May 07, 2000
- 463 views
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 ?