warning: duplicate 'const' declaration specifier

Thread Starter

AlbertHall

Joined Jun 4, 2014
12,343
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
    };
 

Papabravo

Joined Feb 24, 2006
21,157
The construct
LCD_ROW_ADDRESS[]
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
30,701
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.
 

Thread Starter

AlbertHall

Joined Jun 4, 2014
12,343
Not a book that I am familiar with but I found this.
1 John 1:9
If we confess our sins, he is faithful and just to forgive us our sins and to cleanse us from all unrighteousness.
 
Top