On 14 October 2014 01:12, Martin Uecker <uec...@eecs.berkeley.edu> wrote: > Converting a pointer to an array to a pointer to a constant array > is safe. Converting a pointer to a pointer to a pointer to a pointer > to a constant is not (as the CFAQ points out).
You are probably right that it is safe. Unfortunately, C considers invalid cases that are safe and that are allowed by C++ (as mentioned in that C FAQ). I updated the FAQ with comments by Joseph Myers taken from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47143 and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33076. I'm not sure how much effort would be to make the C FE of GCC follow the rules of C++ or whether this would conflict with other parts of the standard (that is, rejecting valid C programs). Perhaps the option could be separated into two, one only enabled by -Wpedantic that controls cases that are known to be safe (-Wpedantic-incompatible-pointer-types? -Wincompatible-but-safe?). Still, someone would need to step up and do the work: https://gcc.gnu.org/wiki/GettingStarted#Basics:_Contributing_to_GCC_in_10_easy_steps Cheers, Manuel.