printf % The conversion specifier expects a pointer to a char array. Note the lack of const . I see the reasons for this in C, and since C ++ includes the C99 standard, this will not change. However, if I write my own printf , can I safely convert the argument to const char* instead ?:
case 's' : ptr = va_arg(va, const char*); _puts(ptr, strlen(ptr)); break;
Will this have any unintended semantics (note: I am not asking about undefined behavior, because such an implementation will not match anyway)?
c ++ c ++ 11
user5477599
source share