Deutsch English Français Italiano |
<20240821165454.000049f8@yahoo.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!2.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Michael S <already5chosen@yahoo.com> Newsgroups: comp.lang.c Subject: Re: on allowing "int a" definition everywhere Date: Wed, 21 Aug 2024 16:54:54 +0300 Organization: A noiseless patient Spider Lines: 25 Message-ID: <20240821165454.000049f8@yahoo.com> References: <afdfe7c37c6ad739fd82c7ec0587b82e0963fce2@i2pn2.org> <va2i90$3f4dg$1@dont-email.me> <pan$8a32c$1fb86219$8ea0c6ae$7c2d1765@invalid.invalid> <va4id0$3rc3n$1@dont-email.me> <va4mtb$3rvat$1@dont-email.me> <va4oeo$3s6p8$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Injection-Date: Wed, 21 Aug 2024 15:54:16 +0200 (CEST) Injection-Info: dont-email.me; posting-host="11d5efee8a22588d5b60783843d590d1"; logging-data="3990631"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX192v0L2zef9A6pdx8XH1fEJuwK0Kaf/lP0=" Cancel-Lock: sha1:M71C3H3cKjoZA019NIowoakcDx0= X-Newsreader: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32) Bytes: 1705 On Wed, 21 Aug 2024 10:01:12 -0300 Thiago Adams <thiago.adams@gmail.com> wrote: > > For this type of error you need my static analyzer. (cake) :D > Unnecessary. MSVC -W4 gives a warning. #include <cstdio> void foo() { FILE* f = fopen("file1.txt", "r"); if (FILE* f = fopen("file2.txt", "r")) { fclose(f); } if (f) fclose(f); } scopes.cpp(6): warning C4456: declaration of 'f' hides previous local declaration scopes.cpp(5): note: see declaration of 'f'