[ECOS] eCos reference manual needs correction

Alex Schuilenburg alexs@ecoscentric.com
Wed Apr 30 12:17:00 GMT 2008


Ilija Stanislevik wrote on 2008-04-30 10:03:
> 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.
>   
It looks like it is correct in the eCosPro docs:

http://www.ecoscentric.com/ecospro/doc.cgi/html/ref/kernel-thread-create.html

so the fix may be integrated in our next update.

-- Alex


-- 
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