We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5bbc4d5 commit a09a51bCopy full SHA for a09a51b
src/fread.c
@@ -126,13 +126,11 @@ static void Field(FieldParseContext *ctx);
126
//=================================================================================================
127
128
/**
129
- * Drops `const` qualifier from a `const char*` variable, equivalent of
130
- * `const_cast<char*>` in C++.
+ * Drops `const` qualifier from any scalar object, equivalent of
+ * `const_cast` in C++.
131
*/
132
-static char* const_cast(const char *ptr) {
133
- union { const char *a; char *b; } tmp = { ptr };
134
- return tmp.b;
135
-}
+#define const_cast(x) (((union{typeof(x) a; typeof(+(*(x)))* b;}){.a=(x)}).b)
+
136
137
138
* Free any resources / memory buffers allocated by the fread() function, and
0 commit comments