[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Incorrect declarations in src/examples/tsp/mincut.h and mincut.c
From: |
Andrew Makhorin |
Subject: |
Re: Incorrect declarations in src/examples/tsp/mincut.h and mincut.c |
Date: |
Wed, 16 Dec 2020 21:47:10 +0300 |
On Wed, 2020-12-16 at 19:08 +0100, Heinrich Schuchardt wrote:
> On 16.12.20 18:18, Andrew Makhorin wrote:
> > Hi Heinrich,
> >
> > Thank you for your report.
> >
> > I'd like to note that there is no error. The ANSI C Standard
> > (ANSI/ISO
> > 9899-1990) I'm using says in the paragraph 6.2 Type specifiers:
> >
> > Constraints
> >
> > Each list of type specifiers shall be one of the following
> > sets (delimited by commas, when there is more than one set
> > on a line); the type specifiers may occur in any order,
> > possibly intermixed with the other declaration specifiers.
> >
> > [...]
> >
> > int, signed, signed int, or no type specifiers
> >
> > [...]
> >
>
> I wrote warning and not error. And if warnings are easy to avoid there
> is no reason not to avoid them.
>
It is not a good idea to change the code only to avoid warnings. If
necessary, you may specify the option -Wimplicit-int as the compiler
suggests.
> Thanks.
>
> Heinrich
>
> >
> > Best regards,
> >
> > Andrew Makhorin
> >
> >
> >
> > On Wed, 2020-12-16 at 17:42 +0100, Heinrich Schuchardt wrote:
> > > Hello Andrew,
> > >
> > > the tsp example results in warnings
> > >
> > > mincut.c:52:38: warning: type defaults to ‘int’ in declaration of
> > > ‘cap’
> > > [-Wimplicit-int]
> > > 52 | const int end[/*1+ne*/], const cap[/*1+ne*/], int
> > > cut[/*1+nn*/])
> > > | ^~~
> > > mincut.c:225:38: warning: type defaults to ‘int’ in declaration of
> > > ‘cap’
> > > [-Wimplicit-int]
> > > 225 | const int end[/*1+ne*/], const cap[/*1+ne*/], int
> > > cut[/*1+nn*/])
> > > |
> > >
> > > In file included from main.c:83:
> > > mincut.h:9:38: warning: type defaults to ‘int’ in declaration of
> > > ‘cap’
> > > [-Wimplicit-int]
> > > 9 | const int end[/*1+ne*/], const cap[/*1+ne*/], int
> > > cut[/*1+nn*/]);
> > > | ^~~
> > > mincut.h:18:38: warning: type defaults to ‘int’ in declaration of
> > > ‘cap’
> > > [-Wimplicit-int]
> > > 18 | const int end[/*1+ne*/], const cap[/*1+ne*/], int
> > > cut[/*1+nn*/]);
> > > | ^~~
> > > In file included from mincut.c:8:
> > > mincut.h:9:38: warning: type defaults to ‘int’ in declaration of
> > > ‘cap’
> > > [-Wimplicit-int]
> > > 9 | const int end[/*1+ne*/], const cap[/*1+ne*/], int
> > > cut[/*1+nn*/]);
> > > | ^~~
> > > mincut.h:18:38: warning: type defaults to ‘int’ in declaration of
> > > ‘cap’
> > > [-Wimplicit-int]
> > > 18 | const int end[/*1+ne*/], const cap[/*1+ne*/], int
> > > cut[/*1+nn*/]);
> > > | ^~~
> > > mincut.c:52:38: warning: type defaults to ‘int’ in declaration of
> > > ‘cap’
> > > [-Wimplicit-int]
> > > 52 | const int end[/*1+ne*/], const cap[/*1+ne*/], int
> > > cut[/*1+nn*/])
> > > | ^~~
> > > mincut.c:225:38: warning: type defaults to ‘int’ in declaration of
> > > ‘cap’
> > > [-Wimplicit-int]
> > > 225 | const int end[/*1+ne*/], const cap[/*1+ne*/], int
> > > cut[/*1+nn*/])
> > >
> > >
> > > Please, replace the files according to the appendix.
> > >
> > > Best regards
> > >
> > > Heinrich
>
>