Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

What does "#pragma argsused" do ?

557 views
Skip to first unread message

Yang Xiang

unread,
Sep 17, 2001, 8:00:24 PM9/17/01
to
I've seen this being used in Win32 code everywhere. What does it mean ?

Any hints will be appreciated.

/yx

Victor Bazarov

unread,
Sep 17, 2001, 8:14:14 PM9/17/01
to
"Yang Xiang" <yangx...@hotmail.com> wrote...

> I've seen this being used in Win32 code everywhere. What does it mean ?


Any #pragma is implementation-specific (that means the Standard
C++ does not specify what they do or mean). You need to ask in
a forum dedicated to the compiler used for the source you're
referring to.

Victor
--
Please remove capital A's from my address when replying by mail


Joe Hotchkiss

unread,
Sep 18, 2001, 8:02:59 AM9/18/01
to
Victor Bazarov wrote:
>
> "Yang Xiang" <yangx...@hotmail.com> wrote...
> > I've seen this being used in Win32 code everywhere. What does it mean ?
>
> Any #pragma is implementation-specific (that means the Standard
> C++ does not specify what they do or mean). You need to ask in
> a forum dedicated to the compiler used for the source you're
> referring to.

I suspect that in your compiler it supresses warnings about function
arguments which are not used in the function definition. For a more
authoritative answer, you will have to do as Victor said, or find out
how to look up the help for your own compiler.

A better way of supressing such warnings would be to remove the argument
name (not very practical in a header that must be compatible with C), or
remove the argument completely. Since you have existing code using the
#pragma, I would just not worry about it.

--
Regards,

Joe Hotchkiss, joe.ho...@baesystems.com
Systems and Processing Group, Tel: +44-20-8420-3523
Sensor Systems Division, Fax: +44-20-8420-3960
BAE SYSTEMS Avionics Limited,
The Grove, Warren Lane,
Stanmore, Middlesex.
HA7 4LY, England.

http://joe.hotchkiss.com

Sriram V Iyer

unread,
Sep 18, 2001, 9:24:00 AM9/18/01
to
Hi Yang,
It is simply to tell the compiler that "Dont generate warning when I
dont use some arguments in the funcion"

For e.g.

consider
int foo ( int a, int b )
{ return a * a; }

While compiling this program, the compiler will warn you that variable
b is not being used. To suppress that warning ... To tell the compiler
that you "know" that some of the function arguments are not being
used, you can use this pragma.

(May be you have b for some extension purposes and for the current
release you are not implementing it and you dont want to change the
interface for foo for the next build. )

To suppress this u give

#pragma argsused
int foo ( int a, int b )
{ return a * a; }

IMHO it is better to let the compiler give the warning. (Unless ur
manager / instructor wants u to have 0 errors, 0 warning code) ;-)

Regards,
Sriram V Iyer

0 new messages