Skip to content

Commit

Permalink
Using static_cast<char*> to replace (char*)
Browse files Browse the repository at this point in the history
  • Loading branch information
gangliao committed Aug 14, 2017
1 parent b4755c5 commit 8210bce
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions paddle/platform/enforce.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,11 @@ struct EnforceNotMet : public std::exception {
for (int i = 0; i < size; ++i) {
if (dladdr(call_stack[i], &info)) {
auto demangled = demangle(info.dli_sname);
sout << string::Sprintf(
"%-3d %*0p %s + %zd\n", i, 2 + sizeof(void*) * 2, call_stack[i],
demangled, (char*)call_stack[i] - (char*)info.dli_saddr);
auto addr_offset = static_cast<char*>(call_stack[i]) -
static_cast<char*>(info.dli_saddr);
sout << string::Sprintf("%-3d %*0p %s + %zd\n", i,
2 + sizeof(void*) * 2, call_stack[i],
demangled, addr_offset);
} else {
sout << string::Sprintf("%-3d %*0p %s\n", i, 2 + sizeof(void*) * 2,
call_stack[i]);
Expand Down

0 comments on commit 8210bce

Please sign in to comment.