Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* Re: C++ macro error on DEC Unix
       [not found] <5sb8r0$4mv$1@coranto.ucs.mun.ca>
@ 1997-08-09  4:00 ` Nikola Milutinovic
  0 siblings, 0 replies; only message in thread
From: Nikola Milutinovic @ 1997-08-09  4:00 UTC (permalink / raw)



Chuan Wang wrote:
> 
> Hi,
> 
> I have the following macro in the c++ code and compiled on a DEC
> Unix machine, it complained about the invalid declaration.
> 
> #define DEFINE_INT_METHODS_BASIC(className) \
>         className& className::operator=(INT16 val) \
>                 {value = val; return *this;}
> 
> the compiler complained at the return value className&.  It looks the DEC
> Unix doesn't take the reference return value.  The macro has been
> successfully compiled on Solaris, AIX and HP-UX.  Anybody can gave me a
> hint why this happened?  Thanks.

Hi.

Macros are considered unwanted resedue of assembler in C and C++.
Templates are supposed to eliminate the need for macros in C++, I.m not
sure if they succeeded in it, though. Anyway, macros are pre-processed,
so if compiler complains, try eliminating the macro as a potential
error.

Try the whole thing without macro. If it does not work, then it's the
problem with C++ syntax. On the other hand, if it works, then there's
something wrong with the macro itself. Try just pro-compiling the macros
only, with cpp command.

Hope this helps.
Nix.



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1997-08-09  4:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <5sb8r0$4mv$1@coranto.ucs.mun.ca>
1997-08-09  4:00 ` C++ macro error on DEC Unix Nikola Milutinovic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox