delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/29/23:33:55

From: "T.E.Dickey" <dickey AT clark DOT net>
Subject: Re: __attribute__((unused)), gcc get's confused...?
Newsgroups: comp.os.msdos.djgpp
References: <Pine DOT SUN DOT 3 DOT 91 DOT 990726093100 DOT 27650E AT is> <379CDE99 DOT 3E957B4 AT unb DOT ca> <7nkach$sak AT cs DOT vu DOT nl>
Organization: Clark Internet Services, Inc., Ellicott City, MD USA
User-Agent: tin/pre-1.4-19990624 ("Dawnrazor") (UNIX) (SunOS/5.6 (sun4u))
Lines: 24
Message-ID: <XLZn3.127$2O3.4229@iad-read.news.verio.net>
Date: Thu, 29 Jul 1999 14:43:03 GMT
NNTP-Posting-Host: 168.143.0.8
X-Complaints-To: abuse AT verio DOT net
X-Trace: iad-read.news.verio.net 933259383 168.143.0.8 (Thu, 29 Jul 1999 14:43:03 GMT)
NNTP-Posting-Date: Thu, 29 Jul 1999 14:43:03 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

mdruiter AT cs DOT vu DOT nl wrote:
> To tell gcc (and other compilers) that an argument is unused _in C++_
> (*not* in C, use __attribute__((unused)) there!), just do not give the
> variable a name:

> int main(int, char* argv[])

> It might even be specified in the ANSI C++ draft IIRC.
     ^^^^^ (maybe not - gcc and g++ don't necessarily follow the standard,
	    and I occasionally get patches from people who don't know the
	    difference)

In this case though (the documentation that comes with g++ asserts):

`unused'
     This attribute, attached to a function, means that the function is
     meant to be possibly unused.  GNU CC will not produce a warning
     for this function.  GNU C++ does not currently support this
     attribute as definitions without parameters are valid in C++.

-- 
Thomas E. Dickey
dickey AT clark DOT net
http://www.clark.net/pub/dickey

- Raw text -


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