Re: #define and (brackets)



"Alan Carre" <alan@xxxxxxxxxxxxxxxxx> wrote in message
news:O2UQLypTJHA.1332@xxxxxxxxxxxxxxxxxxxx
Correction. On it's own it works, but in a macro it doesn't:

#define SHRX -10
#define SHRY -20
#define SHRINK(rect) rect.DeflateRect(-6-SHRX,6-SHRY)

You get a compile error.

This looks like a bug in MSVC compiler. This program:

void f(int, int) {}

#define SHRX -10
#define SHRY -20
#define SHRINK() f(-6-SHRX,6-SHRY)

int main()
{
SHRINK();
return 0;
}

produces an error in VC (I tried VC7.1 and VC8), but compiles fine with
Comeau. Anybody has later versions handy to check?
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


.



Relevant Pages

  • Re: #define and (brackets)
    ... #define SHRX -10 ... #define SHRY -20 ... You get a compile error. ... void f(int, int) ...
    (microsoft.public.vc.language)
  • Re: #define and (brackets)
    ... #define SHRX -10 ... #define SHRY -20 ... void f(int, int) ... I would never expect the above to compile. ...
    (microsoft.public.vc.language)
  • Re: #define and (brackets)
    ... #define SHRX -10 ... #define SHRY -20 ... You get a compile error. ... Alan Carre ...
    (microsoft.public.vc.language)
  • Re: #define and (brackets)
    ... #define SHRX -10 ... #define SHRY -20 ... You get a compile error. ... does the trick. ...
    (microsoft.public.vc.language)
  • Re: why does adding 2 bytes together result in an int?
    ... This is because the devleopers of the platform have decided that the return ... compile error: Cannot implicitly convert type 'int' to 'byte'. ... I need to convert ttl into an int? ...
    (microsoft.public.dotnet.languages.csharp)