Re: Use of static ?



In article <1129328054.840161.134400@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
codefixer@xxxxxxxxx wrote:

> Hello:
>
> I am trying to understand the use of static in this program.
> http://nanocrew.net/sw/nscdec.c for "inverse" matrix.
>
> What difference would it make if it were not static and just "const
> unsigned char inverse[ 128 ]" in global space which it already is ?

Do you think nobody else would ever have the idea to use an array named
"inverse" ?

Use of the "static" keyword means that this one file is the only place
where the "inverse" matrix is used. If you want to change the algorithm
used, and therefore change the size or contents of the "inverse" matrix,
you would have to check every single source code file whether it
accesses that array or not. Making it static means you have to check
only that one file.
.



Relevant Pages

  • Re: MapViewOfFile v ReadFile experiments and results
    ... > I don't know the specific algorithm used by the file cache under Windows ... there would be a similar delay when ReadFile first accesses ... reading chunk by chunk, I also mean using the FILE_FLAG_SEQUENTIAL_SCAN ...
    (microsoft.public.win32.programmer.kernel)
  • Re: collatz proof algorithm reveals e
    ... I do this to maintain the loop ... invariants of the algorithm so although this call to collatz may seem ... Prev by Date: ...
    (sci.math)
  • Re: Looking for a good number theory book with lots of theorems.
    ... I think this is very nice book especially for those who have a good computer science background (who of course did study a course in analysis and design of algorithm) ... but my advice this the book you should look for. ... Prev by Date: ...
    (sci.math)
  • Re: Printf problem with big numbers....
    ... But I changed my algorithm, and now work directly in base 2, and ... instead of printing the results in base 10 or base 2, ... strings, and not with numbers, so it is ok. ... Prev by Date: ...
    (comp.lang.c)
  • Re: compute the order of orbit
    ... "Elegance is an algorithm" ... Iain M. Banks, _The Algebraist_ ... Prev by Date: ...
    (sci.math)