Page 1 of 1

little constiness problem in chibios3

Posted: Tue Mar 01, 2016 6:00 pm
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

Re: little constiness problem in chibios3

Posted: Tue Mar 01, 2016 6:13 pm
by Giovanni
Hi,

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

Giovanni