This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: c/594: cpp errs when one macro calls another


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]