delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/27/09:30:25

From: mdruiter AT cs DOT vu DOT nl
Newsgroups: comp.os.msdos.djgpp
Subject: Re: __attribute__((unused)), gcc get's confused...?
Date: Tue, 27 Jul 1999 12:57:53 GMT
Organization: Fac. Wiskunde & Informatica, VU, Amsterdam
Lines: 14
Message-ID: <7nkach$sak@cs.vu.nl>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 990726093100 DOT 27650E AT is> <379CDE99 DOT 3E957B4 AT unb DOT ca>
NNTP-Posting-Host: galjas.cs.vu.nl
X-Sender: mdruiter AT cs DOT vu DOT nl
User-Agent: tin/pre-1.4-19990413 ("Endemoniada") (UNIX) (SunOS/5.5.1 (sun4u))
X-Poster-Key: sha1:dZUjY0Csv4hvX5qeTUiD/Tzaatk=
Cancel-Lock: sha1:9n25rRfv1MLtXeZPg5Oyg4AQDyU=
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Endlisnis <s257m AT unb DOT ca> wrote:
> int main(int argc __attribute__((unused)), char** argv)
>  b.cc(1) Error: parse error before `__attribute__'

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.

-- 
Groeten, *Michel*       _http://www.cs.vu.nl/~mdruiter_

- Raw text -


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