Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider declaring the name of the entities as "CHAR const *" instead of "CHAR *" #383

Open
pirgia opened this issue Apr 29, 2024 · 3 comments
Labels
feature New feature or enhancement request

Comments

@pirgia
Copy link

pirgia commented Apr 29, 2024

The functions that create an entity (thread, semaphore, etc.), take the entity's name as CHAR*.
I believe that, as the name isn't likely to change, the constness of the name (in the structures and the parameters) would be a nice to have feature.
But the reason of the request is that, while it is allowed in "C" to pass a constant string to a "char *" parameter, in C++ (starting from C++11) it is not allowed to pass a string literal (constant) to a "char *" parameter (ISO C++ forbids converting a string constant to 'CHAR *').
The latter forces the user (interfacing a C++ application with ThreadX) to const-cast the name of the entity, something like:

tx_thread_create(&thread1, const_cast<char*>("Thread name"),....);

which is ugly and, above all, not recommended by many coding standards.
I'd like to know your opinion.
Thanks for your attention.

@pirgia pirgia added the feature New feature or enhancement request label Apr 29, 2024
@MaJerle
Copy link

MaJerle commented Apr 29, 2024

Fully support this. It should have been done from the day 1.

@hwmaier
Copy link

hwmaier commented Apr 29, 2024

This is an issue which has been raised and discussed earlier. Refer to #61

@hwmaier
Copy link

hwmaier commented Oct 2, 2024

Thankfully we have now a PR to address this long standing issue. Refer to #414

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or enhancement request
Projects
None yet
Development

No branches or pull requests

3 participants