little constiness problem in chibios3

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
User avatar
alex31
Posts: 445
Joined: Fri May 25, 2012 10:23 am
Has thanked: 57 times
Been thanked: 88 times

little constiness problem in chibios3

Post by alex31 »

Hello, i have began the porting of my codes under chibios3.

I see that what was a define is now a function : chRegGetThreadNameX, and get some problems because
in

Code: Select all

const char *chRegGetThreadNameX(thread_t *tp)

thread_t *tp is not const.

since it returns a const field (that should not be changed, there is another function for that), it should not be a problem to change signature to

Code: Select all

 const char *chRegGetThreadNameX(const thread_t *tp)
?

this change shoud not break existing code, and permit to use chRegGetThreadNameX on a const Thread * variable, which was ok in chibios 2.6 since chRegGetThreadName was a macro just referencing p_name field.

Alexandre
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: little constiness problem in chibios3

Post by Giovanni »

Hi,

I am not sure, a const thread_t structure makes no sense.

Giovanni
Post Reply