www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/11/24/15:02:38

Date: Mon, 25 Nov 1996 08:50:19 +0000
From: Bill Currie <billc AT blackmagic DOT tait DOT co DOT nz>
Subject: Re: v2 unwanted warnings
To: "A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk>
Cc: DJGPP AT delorie DOT com
Reply-to: billc AT blackmagic DOT tait DOT co DOT nz
Message-id: <32995DCB.26C7@blackmagic.tait.co.nz>
Organization: Tait Electronics NZ
MIME-version: 1.0
References: <131D93180C AT fs2 DOT mt DOT umist DOT ac DOT uk>

A.Appleyard wrote:
>   When v2 compiled this just now:-
> 
> #define nu __attribute__ ((unused))
> class point{public: double x,y;};
> int miaow(point nu w,double nu z){}
> main(){}
> 
>   I got this:-
> 
> C:\AMNEW>gcc t$$$.cc -Wall
> t$$$.cc:3: warning: `unused' attribute ignored
> t$$$.cc:3: warning: `unused' attribute ignored
> t$$$.cc: In function `int miaow(class point, double)':
> t$$$.cc:3: warning: unused parameter `class point w'
> t$$$.cc:3: warning: unused parameter `double z'
> t$$$.cc:3: warning: control reaches end of non-void function `miaow(point, doubl
> e)'

Since your using C++, just drop the names of any unused parameters (this
is standard c++).
ie
class point{public: double x,y;};
int miaow(point, double){}
main(){}

The __attribute__((unused)) is for C bacause the language doesn't allow
unnamed paramters.

Bill
-- 
Leave others their otherness.

- Raw text -


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