Re: extern const initialized warns in C

2018-01-25 Thread Jonathan Wakely
On 25 January 2018 at 12:29, Jonathan Wakely wrote: > On 25 January 2018 at 12:27, Georg-Johann Lay wrote: >> On 22.01.2018 16:20, Jonathan Wakely wrote: >>> >>> On 21 January 2018 at 12:08, Georg-Johann Lay wrote: Jay K schrieb: > > > extern const int foo = 123; > > W

Re: extern const initialized warns in C

2018-01-25 Thread Jonathan Wakely
On 25 January 2018 at 12:27, Georg-Johann Lay wrote: > On 22.01.2018 16:20, Jonathan Wakely wrote: >> >> On 21 January 2018 at 12:08, Georg-Johann Lay wrote: >>> >>> Jay K schrieb: extern const int foo = 123; Why does this warn? This is a valid portable form, with the

Re: extern const initialized warns in C

2018-01-25 Thread Georg-Johann Lay
On 22.01.2018 16:20, Jonathan Wakely wrote: On 21 January 2018 at 12:08, Georg-Johann Lay wrote: Jay K schrieb: extern const int foo = 123; Why does this warn? This is a valid portable form, with the same meaning across all compilers, and, importantly, portably to C and C++. I also wondered

Re: extern const initialized warns in C

2018-01-22 Thread Vincent Lefevre
On 2018-01-22 10:53:55 +0100, David Brown wrote: > On 22/01/2018 10:31, Jay K wrote: > > > > By this argument there is a missing warning for the equivalent: > > > >   const int foo = 123; > > > > with no previous extern declaration. > > I would like to see such a warning. There is "-Wmissing-

Re: extern const initialized warns in C

2018-01-22 Thread Jonathan Wakely
On 21 January 2018 at 12:08, Georg-Johann Lay wrote: > Jay K schrieb: >> >> extern const int foo = 123; >> >> Why does this warn? >> This is a valid portable form, with the same meaning >> across all compilers, and, importantly, portably >> to C and C++. > > > I also wondered about this. > > In C99

Re: extern const initialized warns in C

2018-01-22 Thread Jonathan Wakely
On 21 January 2018 at 07:12, Jay K wrote: > extern const int foo = 123; > > > > Why does this warn? > This is a valid portable form, with the same meaning > across all compilers, and, importantly, portably > to C and C++. > > I explicitly do not want to say: > > const int foo = 123 > > because I

Re: extern const initialized warns in C

2018-01-22 Thread David Brown
- Jay -------- *From:* David Brown *Sent:* Monday, January 22, 2018 10:42 AM *To:* Jay K; gcc *Subject:* Re: extern const initialized warns in C On 22/01/2018 11:14, Jay K wrote: I  meant: extern const foo = 123; does not war

Re: extern const initialized warns in C

2018-01-22 Thread Jay K
exported if they are annotated in source or listed in a separate file. Not just by being non-static. - Jay From: David Brown Sent: Monday, January 22, 2018 10:42 AM To: Jay K; gcc Subject: Re: extern const initialized warns in C On 22/01/2018 11:14, Ja

Re: extern const initialized warns in C

2018-01-22 Thread David Brown
level static. There are no /good/ arguments against file-level static in C, except perhaps temporarily while debugging (it can be easier to view non-static data in a debugger).  Any time file-level static can be used, it /should/ be used. IMHO, of course. mvh., David    - Jay From: David B

Re: extern const initialized warns in C

2018-01-22 Thread Jay K
___ From: David Brown Sent: Monday, January 22, 2018 10:14 AM To: Jay K; gcc Subject: Re: extern const initialized warns in C Hi, I made some points in my other reply. But for completeness, I'll tackle these too. On 22/01/2018 10:38, Jay K wrote: > Also the warning did not i

Re: extern const initialized warns in C

2018-01-22 Thread David Brown
e, I can afford a rename to do it. I am not sure what you mean by that. mvh., David     - Jay From: Jay K Sent: Monday, January 22, 2018 9:31 AM To: David Brown; gcc Subject: Re: extern const initialized warns in C By this argument there is a missing warning for the equivale

Re: extern const initialized warns in C

2018-01-22 Thread David Brown
er). Any time file-level static can be used, it /should/ be used. IMHO, of course. mvh., David  - Jay From: David Brown Sent: Monday, January 22, 2018 8:32 AM To: Jay K; gcc Subject: Re: extern const initialized warns in C On 21/01/18 08:12, Jay K wrote: extern const int foo = 1

Re: extern const initialized warns in C

2018-01-22 Thread Franz Sirl
Am 2018-01-21 um 13:08 schrieb Georg-Johann Lay: Jay K schrieb: extern const int foo = 123; Why does this warn? This is a valid portable form, with the same meaning across all compilers, and, importantly, portably to C and C++. I also wondered about this. In C99 §6.9.2 "External object defin

Re: extern const initialized warns in C

2018-01-22 Thread Jay K
and if I need to make    the symbol extern in future, I can afford a rename to do it.        - Jay From: Jay K Sent: Monday, January 22, 2018 9:31 AM To: David Brown; gcc Subject: Re: extern const initialized warns in C   By this argument there is a missing warning for the equivalent:   con

Re: extern const initialized warns in C

2018-01-22 Thread Jay K
e are many arguments for and against file level static.  - Jay From: David Brown Sent: Monday, January 22, 2018 8:32 AM To: Jay K; gcc Subject: Re: extern const initialized warns in C   On 21/01/18 08:12, Jay K wrote: > extern const int foo = 123; > > > > Why does this warn? &

Re: extern const initialized warns in C

2018-01-22 Thread David Brown
On 21/01/18 08:12, Jay K wrote: > extern const int foo = 123; > > > > Why does this warn? > This is a valid portable form, with the same meaning > across all compilers, and, importantly, portably > to C and C++. > > I explicitly do not want to say: > > const int foo = 123 > > because I want

Re: extern const initialized warns in C

2018-01-21 Thread Georg-Johann Lay
Jay K schrieb: extern const int foo = 123; Why does this warn? This is a valid portable form, with the same meaning across all compilers, and, importantly, portably to C and C++. I also wondered about this. In C99 §6.9.2 "External object definitions" there's actually the following example in