Thanks
D. Falessi
taskSpawn takes only integer values. In many procesors, the
size of a pointer is the same as the size of an integer. Therefore,
if you pass in the right value, the task in question could cast it
or use it in any desired way. (A nasty programming habit, I know,
but if you really need to do it, ......)
Speaking only for myself,
Joe Durusau
The usual problem with using casts this way is that it can lead to
portability problems. If one has no expectations of portability,
and in embedded systems one may genuinely not, then one may have no
problem.
If you expect portability or just wish to better express what is
happening, a better solution is the use of unions. For example, one
could declare pippo thus:
union {
char **ppc;
int i;
} pippo;
Then, when using pippo as a pointer to pointer to char, express it as
pippo.ppc. When using pippo as an integer, express it as pippo.i. The
compilers will now figure out how to allocate pippo such that it will
work regardless of whether the size of a pointer is the same as the size
of an integer.
--
========================================================================
Michael Kesti | "And like, one and one don't make
| two, one and one make one."
mke...@gv.net | - The Who, Bargain
taskSpawn
(
name, /* name of new task (stored at pStackBase) */
priority, /* priority of new task */
options, /* task option word */
stackSize, /* size (bytes) of stack needed plus name */
entryPt, /* entry point of new task */
(int)pippo , /* 1st of 10 req'd task args to pass to func */
.......
);
----
In entry point of the function .
entryPt ( int p2p)
{
char **pippo = (Char **)p2p;
// u got it back here!
}
WITH REGARDS,
rVr
Michael R. Kesti wrote:
Confidentiality Notice
The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or Mail...@wipro.com immediately
and destroy all copies of this message and any attachments.