🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #205

advance macro in test.c - warning

#205
From: perf
Date: Mon, 03 Jul 1989 16:57
39 lines
1353 bytes
This is from test.c:

-------------------
/*
 * advance - increment our position in the argument list.  Check that
 *      we're not past the end of the argument list.  This check is
 *      supressed if the argument is FALSE.  made a macro for efficiency.
 */
#ifndef lint
#define advance(f)      (++pos, f && (pos < argc ? 0 : beyond()))
#endif

#if !defined(advance)
static int
advance(f)
int f;
{
  ++pos;
  if (f && pos >= argc)
    beyond();
}
#endif

-------------------

Some brain damaged compilers evaluate the conditional expression even
if `f' is FALSE.

So if you get "[: argument expected" that's prabably the problem.

Maybe an #ifdef __GNUC__ or #ifndef BRAIN_DAMAGE should be added to
the code...

--
Per Foreby
System manager at EFD, Lund Institute of Technology (Lund University)
Snail: E-huset, Tekniska Hogskolan i Lund, Box 118, S-221 00 LUND, Sweden. 
Email: perf@efd.lth.se		Phone: int + 46 46-10 75 98
Technical Details
Message-ID: <8907031657.AA09298@osiris.efd.lth.se>
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!gatech!tut.cis.ohio-state.edu!EFD.LTH.SE!perf

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!gatech!tut.cis.ohio-state.edu!EFD.LTH.SE!perf
From: perf@EFD.LTH.SE
Newsgroups: gnu.bash.bug
Subject: advance macro in test.c - warning
Message-ID: <8907031657.AA09298@osiris.efd.lth.se>
Date: 3 Jul 89 16:57:21 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 39