[ECOS] eCos reference manual needs correction
Ilija Stanislevik
ilijas@siva.com.mk
Wed Apr 30 11:32:00 GMT 2008
The eCos on-line reference manual
(http://ecos.sourceware.org/docs-2.0/ref/kernel-thread-create.html),
chapter Thread Entry Points and C++, gives an example which does not work.
The example states:
.
.
fred* object = static_cast<fred*>(objptr);
.
It is the static cast which makes compiler unhappy. The variable object is a pointer, while objptr is of type cyg_addrword_t, itself being an unsigned int. Knowing this, it is obvious why the compiler complains.
The issue was solved with the 'dangerous' reinterpret_cast instead of static _cast:
.
.
fred* object = reinterpret_cast<fred*>(objptr);
.
There is an other place within the example which needs the same intervention. Instead of
â¦
cyg_thread_create( â¦,
&fred::static_thread_aux,
static_cast<cyg_addrword_t>(&instance),
â¦);
â¦
I used
â¦
cyg_thread_create( â¦,
&fred::static_thread_aux,
reinterpret_cast<cyg_addrword_t>(&instance),
â¦);
â¦
Now I wonder if this is a general issue or it is limited to my Starter
Kit with AT91SAM926x for EB926x Evaluation Boards from Ronetix?
Is there a better, less 'dangerous' way to solve the issue?
Anyway, it seems that the manual needs to be corrected.
Thank you.
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
More information about the Ecos-discuss
mailing list