local array of structures not declared static
Ken Raeburn
raeburn at MIT.EDU
Thu Dec 8 16:02:50 EST 2005
On Dec 8, 2005, at 13:56, Jeffrey Hutzelman wrote:
>> Shouldn't we add "static" before "const" here?
>
> I guess I'd be midly surprised if that actually had an effect on
> code generation in this case. But I don't see how it could hurt,
> either.
I'd expect minor changes: Static storage references instead of
automatic-variable references, and the initialization (probably a
block-copy from static read-only storage) goes away.
I don't recall seeing any compiler automatically convert a const auto
variable into a static one, and actually I'm not sure if it would be
legitimate in all cases. Perhaps if the address never leaked outside
the current scope.
The kadmin code isn't multithreaded yet, but in multithreaded code,
keeping the stack usage down is a good thing. Generally the stacks
for threads other than the initial one have much smaller size
limits. So, in general, this sort of change is probably a good
thing.....
Ken
More information about the krbdev
mailing list