Deutsch English Français Italiano |
<va4t5q$3t0l0$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Thiago Adams <thiago.adams@gmail.com> Newsgroups: comp.lang.c Subject: Re: on allowing "int a" definition everywhere Date: Wed, 21 Aug 2024 11:21:46 -0300 Organization: A noiseless patient Spider Lines: 27 Message-ID: <va4t5q$3t0l0$1@dont-email.me> 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> <20240821165454.000049f8@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 21 Aug 2024 16:21:47 +0200 (CEST) Injection-Info: dont-email.me; posting-host="87ebdc8a2a448433a767a2e33ec314f2"; logging-data="4096672"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/CqATuRQhjk+OLZIJITtiURNmuHK0H5Ok=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:pS/qS5WIiPGZjA+6hHHYi0OSO34= In-Reply-To: <20240821165454.000049f8@yahoo.com> Content-Language: en-US Bytes: 1936 On 21/08/2024 10:54, Michael S wrote: > 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' The warning cake gives is "use after free" or use after fclose.