This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: c/594: cpp errs when one macro calls another
- To: nobody at gcc dot gnu dot org
- Subject: Re: c/594: cpp errs when one macro calls another
- From: Mihai Moise <mcartoaj at mat dot ulaval dot ca>
- Date: 3 Oct 2000 17:56:00 -0000
- Cc: gcc-prs at gcc dot gnu dot org,
- Reply-To: Mihai Moise <mcartoaj at mat dot ulaval dot ca>
The following reply was made to PR c/594; it has been noted by GNATS.
From: Mihai Moise <mcartoaj@mat.ulaval.ca>
To: gcc-gnats@gcc.gnu.org, nobody@gcc.gnu.org
Cc:
Subject: Re: c/594: cpp errs when one macro calls another
Date: Tue, 3 Oct 2000 13:49:21 -0400 (EDT)
----------
X-Sun-Data-Type: text
X-Sun-Data-Description: text
X-Sun-Data-Name: text
X-Sun-Charset: us-ascii
X-Sun-Content-Lines: 3
There were two small mistakes in my description. Please pass the person the corrected one here attached.
Mihai
----------
X-Sun-Data-Type: default
X-Sun-Data-Description: default
X-Sun-Data-Name: correct.txt
X-Sun-Charset: us-ascii
X-Sun-Content-Lines: 36
In cpp, the code,
#define __T_TYPE float
#define __T_ADD __T_ADD_(__T_TYPE)
__T_ADD
gives,
__T_ADD_(float )
and the code,
#define __T_ADD_(name) name##_add
__T_ADD_(float )
gives,
float_add
However, the code,
#define __T_TYPE float
#define __T_ADD_(name) name##_add
#define __T_ADD __T_ADD(__T_TYPE)
__T_ADD
gives,
__T_TYPE_add
So if we write the output of a first macro explicitly,
it will work correctly, otherwise, cpp will err when one
macro calls another.