On Wed, Jul 16, 2025 at 08:59:27PM +0600, unadvised wrote:
> Sorry, my email setup is probably force wrapping everything. Long
> lines might cause trouble. I unchecked every wrap option from my end.
> It might be the email service provider, not sure.
> 
> > That is wrong. Make it:
> > 
> >     const int result = pthread_setname_np(pthread_self(), "%s", 
> > name_.c_str())
> 
> I don't know if I'm doing something wrong.
> It shows error if I make this change:
> 
> 
> $ conan build . -s build_type=Release -s compiler.cppstd=17 --build=missing 
> -o "&:update_checks=False"
> ...
> ...
> [ 51%] Building CXX object 
> src/cpp-utils/CMakeFiles/cpp-utils.dir/thread/debugging_nonwindows.cpp.o
> /home/username/Projects/cryfs-1.0.1/src/cpp-utils/thread/debugging_nonwindows.cpp:
>  In function ???void cpputils::set_thread_name(const char*)???:
> /home/username/Projects/cryfs-1.0.1/src/cpp-utils/thread/debugging_nonwindows.cpp:32:74:
>  error: invalid conversion from ???const void*??? to ???void*??? 
> [-fpermissive]
>    32 |   const int result = pthread_setname_np(pthread_self(), "%s", 
> name_.c_str());
>       |                                                               
> ~~~~~~~~~~~^~
>       |                                                                       
>    |
>       |                                                                       
>    const void*

Argh! I have no idea why that "arg" is not declaread as const void*.
You could try

  const_cast<char*>(name_.c_str())

or

  __UNCONST(name_.c_str())

Martin

Reply via email to