|
/** |
|
* Drops `const` qualifier from a `const char*` variable, equivalent of |
|
* `const_cast<char*>` in C++. |
|
*/ |
|
static char* _const_cast(const char *ptr) { |
|
union { const char *a; char *b; } tmp = { ptr }; |
|
return tmp.b; |
|
} |
I am aware that the usage of sidestepping constness is used to invoke copy on write behavior.
This is still undefined behavior.
I'm going to investigate to see if I can find a decent solution to this problem, and I also want to hear back if anyone disagrees with my assessment.
data.table/src/fread.c
Lines 126 to 133 in 9c54bd0
I am aware that the usage of sidestepping constness is used to invoke copy on write behavior.
This is still undefined behavior.
I'm going to investigate to see if I can find a decent solution to this problem, and I also want to hear back if anyone disagrees with my assessment.