From: | |
Date: | 20 Feb 2001 at 16:20:40 |
Subject: | Re: [amiga-c] |
Quoting Andrew Crowe <andrewcrowe@enterprise.net>:
> Hi Everybody,
>
> Ok, I know that using #define var_name xxx replaces all the
> "var_name"s in the code with xxx before compiling (so it's faster then
> using a variable), and I /think/ you can do it with piece of code
> like:
>
>
> #define code[a,b,c]{a=b*c+a}
Use () not []. That hasn't got a semi-colon, so is a syntax error, although
you could use () instead of {}, to make that work. It would also be better not
to use a twice in this piece of code, and to throw more brackets in; it also
needs a space between the defined & defining code.
So,
#define code(a,b,c) ((a)+=((b)*(c)))
> so that if you had the line:
>
> code[var1,var2,6]
>
> the compiler would convert that to
>
> var1=var2*6+var1
>
> before compiling (thus being faster thensubroutines).
>
>
> The only problem is I don't know the syntax for the define, and that
> example there didn't work.
>
> See ya :)
You could do this in C++, mind, if you are clever with your operator
overloading.
-------------------------------------------------
This mail sent through UK Online webmail
------------------------ Yahoo! Groups Sponsor ---------------------~-~>
eGroups is now Yahoo! Groups
Click here for more details
http://click.egroups.com/1/11231/0/_/451227/_/982682444/
---------------------------------------------------------------------_->