lovecreatesbea...@gmail.com wrote:
> Can type qualifiers be added through declarations
>
>
> For example, I have one variable defined in file scope without type
> qualifier. In another file, say f1.c, this variable is declared with
> two qualifiers added, and in the third file f2.c, declared with only
> one qualifier added.
>
> Will the variable act just as what they are declared in each file? Is
> it a const and volatile variable in f1.c and only volatile in f2.c?
The behavior is undefined.
6.7.3p9: "For two qualified types to be compatible,
both shall have the identically qualified version
of a compatible type [...]"
6.2.7p2: "All declarations that refer to the same
object or function shall have compatible type;
otherwise, the behavior is undefined."
--
Eric Sosman
lid