Declaring it static, say by putting it out-side the function,
will preserve the contents between calls. However, as long as
you are not initializing it, all the in-function "automatic"
declaration does is allocate space on the stack by bumping up
the stack pointer, so it's not very time consuming.
It might be that access to a static is a bit more efficient
since the compiler can optimize it, and may eliminate a
level of indirection. You'd have to look at the ASM to see
if it's worth while...
Also, 256 bytes is a very large chunk of our little micro-
controllers' available RAM. Keep a close eye on your memory
usage in either case.
MS
José A. Tarifa wrote:
> Hi!
> I'm using some arrays inside of an event, like this:
>
> event void Send.sendDone(...) {
> uint16_t buffer[256];
> (...)
> }
>
> I've thought if I declare "buffer" as a static variable, the CPU
> shouldn't create and remove the variable between event signalling
> (increasing performance ¿?)
> My question: if I declare a variable as static, is kept (in memory) this
> variable between calls???
>
> Thanks!
>
> --
> Jose A.
> Seville, Spain
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help