You need to cast the void* pointer to a char* pointer - and then dereference that char* pointer to give you the char that it points to! But then you need to cast your arguments inside your thread function which is quite unsafe cf. ncdu: What's going on with this second size column? If you write ((char*)ptr + 1), it will advance the pointer 1 byte, because a "char" is 1 byte. Thanks for contributing an answer to Stack Overflow! To be honest, I think, clang is too restrictive here. If you are going to pass the address you typically need to exert some more control over the lifetime of the object. The most general answer is - in no way. C99 defines the types "intptr_t" and "uintptr_t" which do . This is a fine way to pass integers to new pthreads, if that is what you need. @Xax: Here's a fixed version, without the race condition: gist.github.com/depp/241d6f839b799042c409, gist.github.com/depp/3f04508a88a114734195, How Intuit democratizes AI development across teams through reusability. linux c-pthreads: problem with local variables. The proper way is to cast it to another pointer type. For the second example you can make sure that sizeof (int) <= sizeof (void *) by using a static_assert -- this way at least you'll get a notice about it. How to convert a factor to integer\numeric without loss of information? On a 64-bit Windows computer, 'long' is a 32-bit type, and all pointers are 64-bit types. "because the type "int" supports only -32768 ~ 32768" This is not true for any modern desktop or mobile OS or any OS that is targeted by cocos2d-x. But I don't want to edit code in "EAGLView.mm" because it's a "library file". What happens if you typecast as unsigned first? for (i=0, j=0; j
Things To Do In Iuka, Ms,
Jokes About Being Unreliable,
Kennebunkport Police Logs,
Articles C