Re: 'static' to make object accessible by file
In article <78b1bedd-a17a-4c65-9a28-cbab26648da7@e39g2000hsf.googlegroups.com>,
Lax <Lax.Clarke@gmail.com> wrote:
>Say we have a static external object (object defined outside of any
>block with static qualifier) in a file.
>We are telling the compiler that we intend that object to be accessed
>by functions in the current file that are below the definition.
>Now what if one of these functions passes a pointer value to this
>object to a function in another file, and that function uses the
>pointer to access this static object? Is this 'normal' or dependent on
>the specific environment?
That is normal and allowed. There are lurking dangers, such as if
the static data is declared const but the routines do not consistantly
use the const qualifier and ending up modifying the data.
--
'Roberson' is my family name; my given name is 'Walter'.
|