Re: Global variable modifiable by some translation units but not others
- From: Richard <rgrdev@xxxxxxxxx>
- Date: Mon, 18 Dec 2006 01:23:18 +0100
"Spiros Bousbouras" <spibou@xxxxxxxxx> writes:
Let's say I have a global variable int var which I want
to be known to translation units T1 and T2, I want T1
to be able to read its value and modify it and T2 to be
able to read its value but not modify it. Would it work
if I declare it inside T1 as "extern int var" and inside T2
as "extern const int var" ?
Any easy way is to not declare it at all in T2 and only give access via a "get"
function declared in T1. Or?
.
- References:
- Global variable modifiable by some translation units but not others
- From: Spiros Bousbouras
- Global variable modifiable by some translation units but not others
- Prev by Date: Re: tricky array problem !
- Next by Date: Re: Dynamic C to C Data Transfer
- Previous by thread: Re: Global variable modifiable by some translation units but not others
- Next by thread: Re: when to use C and when to use C++
- Index(es):
Relevant Pages
|