Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Keith Thompson <kst-u@mib.org> |
| Newsgroups | comp.lang.c |
| Subject | Re: Intentionally unused variable, suppress warnings for just one? |
| Date | Tue, 02 Aug 2016 14:47:18 -0700 |
| Organization | None to speak of |
| Lines | 28 |
| Message-ID | <lneg663kt5.fsf@kst-u.example.com> (permalink) |
| References | <nnr3ga$pjj$1@dont-email.me> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Injection-Info | mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="27013"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/WDMKt6cgdt55e/gMdpyGi" |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
| Cancel-Lock | sha1:FrN8VL+eFZHyL4076VZlRxyITBk= sha1:e7fKderDQt6pa7tnLSxq/5qIcFs= |
| Xref | csiph.com comp.lang.c:91584 |
Show key headers only | View raw
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