[lkml]   [2003]   [Oct]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] Autoregulate vm swappiness cleanup
On Tue, 28 Oct 2003 10:54:56 EST, "Richard B. Johnson" said:

> I keep hearing 'pollutes the global namespace' all the time, now. Do
> you mean that 'C' code designers actually intend to use the same
> name for different procedures or objects in different files?

Right. Exactly.

That's why you need to have module1_debug_level, module2_debug_level,
module3_debug_level and so on, rather than have a 'debug_level' that's visible
in module1, another that's visible in module2, and a third that's visible in
module3. Note that you *CAN* do that if module1, module2, and module3 are all
*single* .c files simply by declaring it 'static int debug_level;'. But if you
decide to splt module1 and module2 into 2 .c files each, suddenly you need to
rename *both* variables....
And I'm *positive* that *nobody* on this list has done that, forgotten to
rename the variables, and then wondered why module1 has 'debug_level = 1;' in
it and the debugging output starts and then mysteriously stops some random time
after (because module2 has 'debug_level = 0;' in it...)

Yes, C does not have a C++ idea of "private data". My point is that quite
often, the use of 'static' to simulate it is the reason for very large .c
[unhandled content-type:application/pgp-signature]
 \ /
  Last update: 2005-03-22 13:58    [from the cache]
©2003-2014 Jasper Spaans. hosted at Digital Ocean