Re: [LAD] G++ trouble

2020-11-17 Thread Adam Sampson
Uwe Koloska writes: > It's standard behavior, but have only found it on There's also a bit about this in David Tribble's list of differences between C++98 and C99: http://david.tribble.com/text/cdiffs.htm#C99-const-linkage -- Adam Sampson

Re: [LAD] G++ trouble

2020-11-17 Thread Uwe Koloska
Am 17.11.20 um 10:59 schrieb Fons Adriaensen: > But it doesn't make sense to me. Yes, we are in the same boat here. > I've always understood 'extern' has > 'defined somewhere but not here'. In other words 'extern' must be > part of a declaration, and not of a definition as that would be > a

Re: [LAD] G++ trouble

2020-11-17 Thread Fons Adriaensen
On Mon, Nov 16, 2020 at 11:24:35PM +0100, Uwe Koloska wrote: > It's standard behavior, but have only found it on > https://en.cppreference.com/w/cpp/language/cv#Notes > > The const qualifier used on a declaration of a non-local non-volatile > non-template (since C++14) non-inline (since C++17)

Re: [LAD] G++ trouble

2020-11-16 Thread Uwe Koloska
Am 16.11.20 um 10:37 schrieb Alexandre DENIS: > > I've already seen this strange behavior with gcc 9.x : symbols with > a const definition are by default not publicly visible. It works > if you explicitly add an "extern" in the definition: > > extern const float svcoeff44 [216] = (...) > > I am

Re: [LAD] G++ trouble

2020-11-16 Thread Will J Godfrey
On Mon, 16 Nov 2020 16:31:18 +0100 Fons Adriaensen wrote: >or > >* Just #define it in a header (e.g. globals.h) instead of creating > a variable. > > >Ciao, > Thanks again. I've gone for this options. It keeps these together, along with a bunch of enums so they're easy to find. -- It

Re: [LAD] G++ trouble

2020-11-16 Thread Fons Adriaensen
On Mon, Nov 16, 2020 at 01:38:01PM +, Will J Godfrey wrote: > I just did a search of the whole of src. It's *used* about a dozen times > across 5 otherwise unrelated .cpp files, but is only defined here. Just to be > certain, I did a make clean before trying this again, and it's definitely

Re: [LAD] G++ trouble

2020-11-16 Thread Will J Godfrey
On Mon, 16 Nov 2020 14:52:53 +0100 Alexandre DENIS wrote: >On Mon, 16 Nov 2020 13:38:01 + >Will J Godfrey wrote: > >> Not wishing to hijack this thread but I'm still confused :( >> >> I just did a search of the whole of src. It's *used* about a dozen >> times across 5 otherwise unrelated

Re: [LAD] G++ trouble

2020-11-16 Thread Alexandre DENIS
On Mon, 16 Nov 2020 13:38:01 + Will J Godfrey wrote: > Not wishing to hijack this thread but I'm still confused :( > > I just did a search of the whole of src. It's *used* about a dozen > times across 5 otherwise unrelated .cpp files, but is only defined > here. Just to be certain, I did a

Re: [LAD] G++ trouble

2020-11-16 Thread Will J Godfrey
On Mon, 16 Nov 2020 13:35:30 +0100 Fons Adriaensen wrote: >On Mon, Nov 16, 2020 at 12:22:54PM +, Will J Godfrey wrote: > >> In GCC 8.3 doing that in a globally included header actually *creates* a >> multiple definitions error! >> >> #ifndef GLOBALS_H >> #define GLOBALS_H >> >> const

Re: [LAD] G++ trouble

2020-11-16 Thread Fons Adriaensen
On Mon, Nov 16, 2020 at 12:22:54PM +, Will J Godfrey wrote: > In GCC 8.3 doing that in a globally included header actually *creates* a > multiple definitions error! > > #ifndef GLOBALS_H > #define GLOBALS_H > > const unsigned int ADD_COLOUR = 0xdfafbf00; fine Putting a definition in a

Re: [LAD] G++ trouble

2020-11-16 Thread Will J Godfrey
On Mon, 16 Nov 2020 13:02:03 +0100 Fons Adriaensen wrote: >On Mon, Nov 16, 2020 at 12:24:10PM +0100, Kjetil Matheussen wrote: > >> A common mistake in C is omitting extern when declaring a global >> variable in a header file. If the header is included by several files >> it results in multiple

Re: [LAD] G++ trouble

2020-11-16 Thread Kjetil Matheussen
On Mon, Nov 16, 2020 at 12:59 PM Roman Sommer wrote: > > Kjetil Matheussen writes: > > > > Yeah, I just read this: https://gcc.gnu.org/gcc-10/porting_to.html > > > > " > > > > C language issues > > > > Default to -fno-common > > > > A common mistake in C is omitting extern when declaring a

Re: [LAD] G++ trouble

2020-11-16 Thread Fons Adriaensen
On Mon, Nov 16, 2020 at 12:24:10PM +0100, Kjetil Matheussen wrote: > A common mistake in C is omitting extern when declaring a global > variable in a header file. If the header is included by several files > it results in multiple definitions of the same variable. But * I _do_ have 'extern' in

Re: [LAD] G++ trouble

2020-11-16 Thread Kjetil Matheussen
Alexandre DENIS: > On Mon, 16 Nov 2020 09:43:42 +0100 > Fons Adriaensen wrote: > > > Hello all, > > > > I'm having a strange problem with G++... > > > > In one source file 'fb3data.cc', I define arrays like this: > > > > const float svcoeff44 [216] = > > { > > 1.631996e-03,

Re: [LAD] G++ trouble

2020-11-16 Thread Alexandre DENIS
On Mon, 16 Nov 2020 09:43:42 +0100 Fons Adriaensen wrote: > Hello all, > > I'm having a strange problem with G++... > > In one source file 'fb3data.cc', I define arrays like this: > > const float svcoeff44 [216] = > { > 1.631996e-03, 6.335480e-02, ... > ... > };

[LAD] G++ trouble -- correction

2020-11-16 Thread Fons Adriaensen
Hello again, This is the correct version: (I typed this in manually instead of copy/paste...) const float *c; switch (fsam) { case 44100: c = svcoeff44; break; case 48000: c = svcoeff48; break; ... } Ciao, -- FA

[LAD] G++ trouble

2020-11-16 Thread Fons Adriaensen
Hello all, I'm having a strange problem with G++... In one source file 'fb3data.cc', I define arrays like this: const float svcoeff44 [216] = { 1.631996e-03, 6.335480e-02, ... ... }; There are five of these. In 'fbdata3.h' I have extern const float svcoeff44