🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #10696

Re: exception "catch" clause

#10696
From: Bob Gonder
Date: Fri, 26 Mar 2004 00:32
27 lines
2020 bytes
p Anders wrote:

>I have several macros defined - some use the parenthesis and some don't -
>when are these required and when not?  Or maybe they're not required at
>all???

In general, no, they aren't required. But... you can get into trouble
in some situations if they aren't used.... Consider

#define	SomeNumber	10+24*13+27
	int	i = SomeNumber;		/* ok */
	int	j = SomeNumber+32;	/* ok */
	int	k = SomeNumber*7;	/* ?? */

IOW, where the macro is going to be used as a sub-expression,
parenthesis are good.

#define	condition		(i<j)
	if condition	//  if (i<j)  ok
	if( condition )	//  if( (i<j) )  ok
	if ! condition	//  if ! (i<j)  not ok

But code generally doesn't contain parens, so putting parens around a
code macro is probably wrong.
Remember, everything you put in a macro, parens and all, goes into the
expanded code. So, if you can't write the original code with parens,
then you can't write the macro with them either.
Technical Details
Message-ID: <mnt660lm9g2ebth873f7bpb93gcit1j409@4ax.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!news-FFM2.ecrc.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4062cd03$1@newsgroups.borland.com> <4062db62$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,d6b749007e0005d0
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-03-25 16:39:46 PST
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: exception "catch" clause
Date: Thu, 25 Mar 2004 16:32:46 -0800
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <mnt660lm9g2ebth873f7bpb93gcit1j409@4ax.com>
References: <4062cd03$1@newsgroups.borland.com> <4062db62$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 67.31.164.117
X-Trace: newsgroups.borland.com 1080261167 67.31.164.117 (25 Mar 2004 16:32:47 -0800)
Lines: 29
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!news-FFM2.ecrc.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail