Changes between Initial Version and Version 1 of Ticket #54903, comment 4
- Timestamp:
- Oct 11, 2017, 5:42:53 PM (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #54903, comment 4
initial v1 6 6 }}} 7 7 8 It appears that clang's Objective C and C++ now use the safe C++ version of 'strrchr' which returns a 'const char*' . This version is presumably intended to prevent unsafe or unintentional modification of immutable string literals through a non constant reference (pointer) to a substring. The C version returns 'char*' which silently drops the const. The explicit cast added in the reinplace above allows the potentially unsafe operation. A better solution might be to change the returntype to 'const char*' for these variables to ensure that AtomicParsley isn't actually performing unsafe string operations. It would be better to fix this in the AtomicParsley source.8 It appears that clang's Objective C and C++ now use the safe C++ version of 'strrchr' which returns a 'const char*' for the overloaded function version that accepts a string literal ('const char*'). This version is presumably intended to prevent unsafe or unintentional modification of immutable string literals through a non constant reference (pointer) to a substring. The C version returns 'char*' which silently drops the const. The explicit cast added in the reinplace above allows the potentially unsafe operation. A better solution might be to change the return variable type to 'const char*' for these variables to ensure that AtomicParsley isn't actually performing unsafe string operations. It would be better to fix this in the AtomicParsley source.