delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/03/17/18:30:08

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: "A. Sinan Unur" <asu1 AT cornell DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: parsing errors
Date: 17 Mar 2002 23:17:04 GMT
Organization: Cornell University
Lines: 46
Sender: asu1 AT cornell DOT invalid (on pool-141-149-207-233.syr.east.verizon.net)
Message-ID: <Xns91D4B9FE663Basu1cornelledu@132.236.56.8>
References: <3C94FA1B DOT 8E6A9BA3 AT roosnek DOT nl>
NNTP-Posting-Host: pool-141-149-207-233.syr.east.verizon.net
X-Trace: news01.cit.cornell.edu 1016407024 2344 141.149.207.233 (17 Mar 2002 23:17:04 GMT)
X-Complaints-To: usenet AT news01 DOT cit DOT cornell DOT edu
NNTP-Posting-Date: 17 Mar 2002 23:17:04 GMT
User-Agent: Xnews/L5
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Roosnek <nico DOT r AT roosnek DOT nl> wrote in news:3C94FA1B DOT 8E6A9BA3 AT roosnek DOT nl:

> Hello,
> 
> I got in the attached subroutine the same severe parsing errors with
> the gcc-3.03 using de latest version of DJGPP. With the previous
> version of DJGPP with the gcc-2.95 compiler I got no error what so
> ever. I cannot see any error in the macro defintion. I hope that is 
> not a bug. Please could you advice about this problem.

i cannot. however, i am not convinced you need all those macros. they are 
way too long (IMO), and make the code impossible to follow (for me). i 
think you would be better off trying to reduce the complexity of the code.

taking another look at the warnings, i see that the first one is:

w.c:175:4: warning: pasting "new_alpha" and "[" does not give a valid 
preprocessing token

which is triggered by the line

   create_priori_angle(alpha);

let's look at the definition of the macro:

#define create_priori_angle( phi ) \
new_##phi##[0]=phi##[0]+phi##[1]*delt;\
new_##phi##[1]=phi##[1];\
P_##phi##[0]+=.0001*delt;P_##phi##[2]+=.001*delt

that just looks weird to me. why not use:

#define create_priori_angle( phi ) \
 new_##phi[0]=phi[0]+phi[1]*delt;  \
 new_##phi[1]=phi[1];\
 P_##phi[0]+=.0001*delt;P_##phi[2]+=.001*delt

after all, ## is used to concatenate the macro argument with text.

<snip>

> #define sqr(a) ((a)*(a))

this is dangerous because a will be evaluated twice.

Sinan.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019