Search code examples
cconstantskeywordsemanticsvolatile

const volatile doubled in production code


I am currently working with production code in ANSI-C, which is partly getting generated by a very intransparent toolchain (so I could not find any clear information about it).

Somewhere in the generated code the following happens:

extern const volatile int16 * const volatile Varray[20];

And the access to it:

int16 myValue = *Varray[var];

It works, this is not part of the question. I just want to know why the const volatile is written before AND after the datatype int16 *.


Solution

  • extern const volatile int16 * const volatile Varray[20];
    

    This just means that both the pointer and the value are "const volatile".

    So, Varray is an array of const volatile pointers which will store const volatile int16's