delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/28/10:05:24

From: kagel AT quasar DOT bloomberg DOT com
Date: Mon, 28 Oct 1996 09:38:21 -0500
Message-Id: <9610281438.AA01767@quasar.bloomberg.com >
To: eliz AT is DOT elta DOT co DOT il
Cc: bhodge AT gpu2 DOT srv DOT ualberta DOT ca, djgpp AT delorie DOT com
In-Reply-To: <Pine.SUN.3.91.961027145451.14799U-100000@is> (message from Eli Zaretskii on Sun, 27 Oct 1996 14:56:49 +0200 (IST))
Subject: Re: Borland library macro equivalent?
Reply-To: kagel AT dg1 DOT bloomberg DOT com

   Errors-To: postmaster AT bloomberg DOT com
   Date: Sun, 27 Oct 1996 14:56:49 +0200 (IST)
   From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
   X-Sender: eliz AT is
   Cc: djgpp AT delorie DOT com
   Mime-Version: 1.0
   Content-Type: TEXT/PLAIN; charset=US-ASCII
   Content-Length: 652


   On 23 Oct 1996, B Hodge wrote:

   > Eli Zaretskii (eliz AT is DOT elta DOT co DOT il) wrote:
   > : 	#define max(a,b) ({ typeof(a) _tmp_a = (a); \
   > : 			    typeof(b) _tmp_b = (b); \
   > : 			    (_tmp_a > _tmp_b) ? _tmp_a : _tmp_b; })
   > 
   > So then the following code would be legal?
   > 
   > x={ int s, c; s=sin(a); c=cos(a); s*s*y+s*c*y+c*c*y; };

   I'm not sure it will work without parentheses around it:

It definitely needs the parenthesis or the compiler complains about a parse 
error.

   x = ({ int s, c; s=sin(a); c=cos(a); s*s*y+s*c*y+c*c*y; });

   But this is documented in the GCC docs; just read there.

   > Is this legal under other languages tooor is it just a DJGPP specific
   > thing?

   It's GCC specific, so it will work on any platform if you use GCC.

I verified this on Data General DG/UX, GCC is the native/delivered compiler
there and this works as advertised.

-- 
Art S. Kagel, kagel AT quasar DOT bloomberg DOT com

A proverb is no proverb to you 'till life has illustrated it.  -- John Keats

- Raw text -


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