There's no proper way to cast this to int in general case. From that point on, you are dealing with 32 bits. The program can be set in such a way to ask the user to inform the type of data and . If it's anything like cocos2d-iphone v2.x and just based on this slice of code in a core class I wager it's safe to say that cocos2d-x 2.x also is not compatible with 64 bit code, and you can expect all kinds of issues (not just compile-time but also runtime). B Programming Language | What is the History and Concept? So, when you cast a (void*) to (long), you are losing 32 bits of data in the conversion. Narrowing Casting (manually) - converting a larger type to a . Using indicator constraint with two variables. @kshegunov said in Number Type Cast: const void * x; int y = int (x); compiles just fine. Why does Mister Mxyzptlk need to have a weakness in the comics? How do I work around the GCC "error: cast from SourceLocation* to int loses precision" error when compiling cmockery.c? If the destination type is bool, this is a boolean conversion (see below). ../lib/odp-util.c:5603:13: note: expanded from macro 'SCAN_PUT' You can fix this error by replacing this line of code. error: cast from 'void*' to 'int' loses precision - Stack Overflow I need to convert the argument to an int for later use: The compiler (GCC version 4.2.4) returns the error: You can cast it to an intptr_t type. Do roots of these polynomials approach the negative of the Euler-Mascheroni constant? If the original pointer value represents an address of a byte in memory that does not satisfy the alignment requirement of the target type, then the resulting pointer value is unspecified. On a 64-bit Windows computer, 'long' is a 32-bit type, and all pointers are 64-bit types. Only the following conversions can be done with static_cast, except when such conversions would cast away constness or volatility. [Solved] Properly casting a `void*` to an integer in C++ reinterpret_cast conversion - cppreference.com If the source type is bool, the value false is converted to zero and the value true is converted to the value one of the destination type (note that if the destination type is int, this is an integer promotion, not an integer conversion).

Judgement And Chariot Combination, Articles C