Mail Archives: djgpp/1997/04/17/23:21:17
From: | Erik Max Francis <max AT alcyone DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: funny re user-defined ++ and -- operators
|
Date: | Tue, 15 Apr 1997 21:14:23 -0700
|
Organization: | Alcyone Systems
|
Lines: | 43
|
Message-ID: | <3354521F.2AED95FA@alcyone.com>
|
References: | <97Apr11.122200gmt+0100 DOT 21891 AT internet01 DOT amc DOT de>
|
NNTP-Posting-Host: | newton.alcyone.com
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Chris Croughton wrote:
> I have a philosophical objection to having unused arguments.
I understand your objections. I basically strive to achieve no warnings
whatsoever (with all warnings on) from compilers; gcc, what I consider a
very good compilers, even has syntax you can use which, still legal, will
cause the compiler not to emit a warning.
As a concrete example, gcc has a workaround about the if (a = b) warning
(e.g., "Didn't you mean a == b?") which simply has you write if ((a = b)).
Not all compilers are this smart, so often you have to deal with them or
change your coding style.
> It
> comes from many years of compilers and lint complaining about
> unused arguments (so much so that I have a standard
>
> #define NOTUSED(x) (x=x)
>
> to satisfy compilers - it's usually optimised out but generally
> after it has suppressed the warning).
Since we're talking C++, you can simply not name the variables passed into
functions. e.g., if you have a function f which takes an argument i which
is not used, you can change the definition
void f(int i) { ... }
to
void f(int /* i */) { ... }
and C++ compilers won't complain.
--
Erik Max Francis, &tSftDotIotE / email / max AT alcyone DOT com
Alcyone Systems / web / http://www.alcyone.com/max/
San Jose, California, United States / icbm / 37 20 07 N 121 53 38 W
\
"The future / is right there."
/ Bill Moyers
- Raw text -