Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Intentionally unused variable, suppress warnings for just one? |
| Date | 2016-08-02 14:47 -0700 |
| Organization | None to speak of |
| Message-ID | <lneg663kt5.fsf@kst-u.example.com> (permalink) |
| References | <nnr3ga$pjj$1@dont-email.me> |
mathog <dmathog@gmail.com> writes:
> This is probably off topic, but somebody here is likely to know how to
> do this, so...
>
> In some code there is a function:
>
> SOME_STRUCTURE_TYPE a_structure;
> int a_result = a_function(&a_structure);
>
> where "a_result" is never referred to again in the rest of the code.
[reasons snipped]
> What I want to do is suppress the warning only for these 10 lines.
This seems to work for gcc, and may work for other compilers as well:
SOME_STRUCTURE_TYPE a_structure;
int a_result = a_function(&a_structure);
(void)a_result;
(I might wonder whether you really should be ignoring the result, but
there's not enough information to speculate.)
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Intentionally unused variable, suppress warnings for just one? mathog <dmathog@gmail.com> - 2016-08-02 14:30 -0700
Re: Intentionally unused variable, suppress warnings for just one? Keith Thompson <kst-u@mib.org> - 2016-08-02 14:47 -0700
Re: Intentionally unused variable, suppress warnings for just one? mathog <dmathog@gmail.com> - 2016-08-02 15:14 -0700
Re: Intentionally unused variable, suppress warnings for just one? David Brown <david.brown@hesbynett.no> - 2016-08-03 14:17 +0200
Re: Intentionally unused variable, suppress warnings for just one? gordonb.sapr8@burditt.org (Gordon Burditt) - 2016-08-02 16:52 -0500
Re: Intentionally unused variable, suppress warnings for just one? David Brown <david.brown@hesbynett.no> - 2016-08-03 14:21 +0200
Re: Intentionally unused variable, suppress warnings for just one? James Kuyper <jameskuyper@verizon.net> - 2016-08-03 10:46 -0400
csiph-web