# warning: duplicate 'const' declaration specifier

#### AlbertHall

Joined Jun 4, 2014
11,217
This is code for the XC8 compiler (C99) and it gives me the warning in the title. Can I ignore this warning or is one of the 'const' redundant?
Code:
const uint8_t const LCD_ROW_ADDRESS[] =                    // Row/Column information for lcd_gotoxy()
{
#if LCD_MODE_1x8
0x00
#endif
#if LCD_MODE_1x16_A
0x00
#endif
#if LCD_MODE_1x16_B
0x00,
0x40
#endif
#if LCD_MODE_1x40
0x00,
#endif
#if LCD_MODE_2x8
0x00,
0x40
#endif
#if LCD_MODE_2x12
0x00,
0x40
#endif
#if LCD_MODE_2x16
0x00,
0x40
#endif
#if LCD_MODE_2x20
0x00,
0x40
#endif
#if LCD_MODE_2x24
0x00,
0x40
#endif
#if LCD_MODE_2x40
0x00,
0x40
#endif
#if LCD_MODE_4x16
0x00,
0x40,
0x10,
0x50
#endif
#if LCD_MODE_4x20
0x00,
0x40,
0x14,
0x54
#endif
#if LCD_MODE_4x24
0x00,
0x40,
0x80,
0xc0
#endif
};

#### MrChips

Joined Oct 2, 2009
23,221
Why do you have two const in line 1?

#### AlbertHall

Joined Jun 4, 2014
11,217
I don't. This is some code from www that I am trying to get working.

#### Papabravo

Joined Feb 24, 2006
15,731
The construct
is a shorthand for &LCD_ROW_ADDRESS(0) and as such is already a constant. The const out in front refers to the "constants" in the array. So pointers to fixed addresses are already constants. I don't think it will hurt anything, but I would get rid of it regardless. Code is much easier to debug if you don't have a pile of warnings. Besides you don't want to pass this code on if the compiler is barking at you.

#### MrChips

Joined Oct 2, 2009
23,221
I don't. This is some code from www that I am trying to get working.
That is the drawback with trying to use code off the www that someone else wrote.
I prefer to get an idea of what the code is supposed to do and then rewrite it in my own code.

#### AlbertHall

Joined Jun 4, 2014
11,217
That is the drawback with trying to use code off the www that someone else wrote.
I prefer to get an idea of what the code is supposed to do and then rewrite it in my own code.
Yes, but whenever I can I choose laziness

#### Papabravo

Joined Feb 24, 2006
15,731
Yes, but whenever I can I choose laziness
Isn't there a biblical quote about the wages of laziness? Wink back atcha