TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Peter Fitzsimmons
from: jari laaksonen
date: 1996-08-03 19:01:52
subject: Need IBM/Watcom help

PF> I have a large program littered with these:

PF>         #pragma off (unreferenced)

PF> It is a Watcom pragma,  which I want to leave in the code.  For
PF> readabilty,  I don't want to replace each of these with a five line
PF> "#ifdef __IBMC__" block.

PF> Can anyone think of a clever way to make the preprocessor work for me?
PF> I don't mind changing the above line;  but I want to leave at as one
PF> line,and select a different #pragma for different compilers.

First I thought that defining different macros would work, like this:

#if defined (__IBMC__) || defined (__IBMCPP__)
# define UNREF  info (nopar, nouse)
#elif defined (__WATCOMC__)
# define UNREF  off (unreferenced)
#elif defined (_MSC_VER)
# define UNREF  warning (disable:4100)
#endif

#pragma UNREF
int f (int a)
{
  return 0;
}


...but Watcom and IBM preprocess pragmas differently than MSVC. In other
words, above works with MSVC but not with others.

How about this approach:

#define UNREFERENCED(a) ((void)(a))

int f1 (int a)
{
  return 0;
  UNREFERENCED(a);
}



        // Albert                      email: jla{at}to.icl.fi

--- GoldED/2 2.50+
* Origin: Albert's Point/2 in Finland, Europe (2:221/360.20)
SEEN-BY: 50/99 270/101 620/243 625/100 711/401 409 410 413 430 808 809 934
SEEN-BY: 711/955 712/407 515 624 628 713/888 800/1
@PATH: 221/360 0 22/10 229/0 270/101 712/515 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.