scope Q
Dan Mick
dan at kfw.COM
Tue Apr 23 10:15:43 AEST 1991
In article <1991Apr19.151959.6847 at noose.ecn.purdue.edu> muttiah at stable.ecn.purdue.edu (Ranjan S Muttiah) writes:
>/* Is there some way I can control the scope of a variable within
>a file ? Something similar to #undef when using #define */
>
>int a,b;
>
>fn1(..)
>{
>....
>}
>
>fn2(..)
>{
>....
>}
>
>/* beep beep, useful life of a is over */
>
>fn3()
>{
>
>a = 5; <- undefined variable: a
>...
>}
Yes. Split the file in two.
Why on earth would you want to do something to completely frustrate the
next person that looks at your code? There's no reason to "unscope" a
variable; if that's what you want, use the perfectly good mechanism of
splitting the file and making the variable have file scope (i.e., not
extern).
I mean, there may *be* a way to do this, but you really shouldn't want to.
Honest.
More information about the Comp.lang.c
mailing list