Re: Macros



"Harry" <gehariprasath@xxxxxxxxx> writes:
Peter "Shaggy" Haywood wrote:
[...]
In article <1164698162.284936.137360@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
Harry <gehariprasath@xxxxxxxxx> wrote:

I have a piece of code as

# define prod(a,b)=a*b
main()
{
int x=2;
int y=3;
printf("%d",prod(x+2,y-10));
}

[snip]

No, it would expand to this:

printf("%d",=x+2*y-10);

which is a syntax error.

[snip]

Sorry guys,that = is not present in the maro expansion.It was my
mistake & thanks for clearing the doubt.

The way to avoid that kind of mistake is to post the *exact* code that
you actually fed to your compiler. Copy-and-paste it, don't try to
re-type it. If you re-type it, you will inevitably introduce
irrelevant errors, and we won't be able to resist the temptation to
discuss them at great length. If you're lucky, we *might* eventually
get back to your actual problem.

Also, it's usually not necessary to quote the entire article to which
you're replying. Just quote enough so that your followup makes sense
on its own; trim anything that's not relevant, as I've done here. In
particular, don't quote signatures unless you're actually commenting
on them.

--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.



Relevant Pages