L
Lax
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?
This works on my system but I am not sure if this is a normal thing I
should be doing or it's just because my environment/compiler isn't
picking up on the bad move. If it's okay, is it bad style?
So, does the C standard say that such a move is allowed (either
directly or indirectly by not saying that it is disallowed)?
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?
This works on my system but I am not sure if this is a normal thing I
should be doing or it's just because my environment/compiler isn't
picking up on the bad move. If it's okay, is it bad style?
So, does the C standard say that such a move is allowed (either
directly or indirectly by not saying that it is disallowed)?