There are ways to prevent this: pass a dynamic allocated argument if your not the passing thread is not static or if your argument is a local variable, otherwise there is no issue. @Artelius: Which, presumably, is exactly what Joshua did: A C++ reinterpret cast will not solve the problem. [Solved] Disabling "cast from pointer to smaller type | 9to5Answer Many errors come from warnings. OP said he doesn't want it. How do I work around the GCC "error: cast from SourceLocation* to int loses precision" error when compiling cmockery.c? rev2023.5.1.43405. Clang warnings for an invalid casting? - The FreeBSD Forums 1) zero or one conversion from the following set: lvalue-to-rvalue conversion, array-to-pointer conversion, and function-to-pointer conversion; 2) zero or one numeric promotion or numeric conversion; 3) zero or one function pointer conversion; (since C++17) 4) zero or one qualification conversion. Were sorry. From what I read about casting in the C11 standard, my feeling is, that it is arguable to emit a warning on an explicit conversion. Can anybody explain how to pass an integer to a function which receives (void * ) as a parameter? Find centralized, trusted content and collaborate around the technologies you use most. On a 64-bit Windows computer, 'long' is a 32-bit type, and all pointers are 64-bit types. But you seem to suggest by your answer that the user can pass 5 to pthread_create and then perform the above cast to get it back. Passing negative parameters to a wolframscript, Generating points along line with specifying the origin of point generation in QGIS. You are right! To access the object value, use the * dereference operator: int * p; assert (p == null ); p = new int (5); assert (p != null ); assert (*p == 5); (*p)++; assert (*p == 6); If a pointer contains a null value, it is not pointing to a valid object. How to cast a void pointer to any other type in C || #C Programming language || Coding is Life 487 03 : 37 Unable to cast object of type 'System DateTime' to type 'System String' SharpCoder 336 10 : 53 Tkinter window geometry to manage height width and zoom out using state and resizable () option plus2net 107 Author by david.brazdil