Skip to content Skip to sidebar Skip to footer

Crash In Release Mode, But If Debuggable True - Not... What Is Possible Issue?

I made a sample project using ndk + openGL. Idea of the app is simple, open the camera when you tap on the screen AR object appear on place where you tapped. When I worked in debug

Solution 1:

"" + ((char) pkmHeader[0]) is a const char*, and therefore std::string::append() can receive it. But the value of this const char* is not "A" (assuming that pkmHeader[0] == 'A'). The result of "" + ((char) pkmHeader[0]) is a pointer to (preallocated) "" constant with offset of 65 from that pointer. For me,

printf("%p %p\n", "", "" + ((char) 'A') );

prints:

0x7f3cbf201025 0x7f3cbf201066

Note that 0x7f3cbf201066 - 0x7f3cbf201025 = 0x41, the value of 'A'.

To fix your code, use

magicNumber.append(pkmHeader, 4);

Post a Comment for "Crash In Release Mode, But If Debuggable True - Not... What Is Possible Issue?"