Uhm, I have found a solution :-) The problem is that C (or GCC) can
only change variable out of function using "*variable=value"
construct. This "*variable" syntax is essential. This is the only
possible way of using pointer to pass information outside function.
But this way it is only possible to pass the VALUE, not the pointer
itself. That is why we need to use double pointer to pass out the
address of the pointer from inside function, even though it seems
rational and sensible to simply change the pointer content to point to
another place in the memory. All this because GCC (or maybe all C
compilers) use local variables to store pointers! So the pointer
content operations does not propagate back to caller functions, they
can only change the existing memory location marked before any
function call! You can change some pointer inside function but the
calling function will overwrite it with its local copy on return...
For me this is one star too much, but that's how things are, maybe
good for security.

All this pointer stuff is necessary to access location of the queue
after flush, to read back the result, but also to make sure we are
reading correct response and this is done by comparison of result
location with location stored when result location was created on the
queue (as there are many others)...

To sum up: single pointer parameter only gives chance to change value
of the location set prior function call, but to get back the location
itself you need a double pointer.

Best regards :-)
Tomek

-- 
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to