what this? this number of answers warnings, errors , notices might encounter while programming php , have no clue how fix. community wiki, invited participate in adding , maintaining list. why this? questions "headers sent" or "calling member of non-object" pop on stack overflow. root cause of questions same. answers questions typically repeat them , show op line change in his/her particular case. these answers not add value site because apply op's particular code. other users having same error can not read solution out of because localized. sad, because once understood root cause, fixing error trivial. hence, list tries explain solution in general way apply. what should here? if question has been marked duplicate of this, please find error message below , apply fix code. answers contain further links investigate in case shouldn't clear general answer alone. if want contribute, please add "favorite" error message, warning or notic...
consider code: struct foo { const char str[] = "test"; }; int main() { foo foo; } it fails compile both g++ , clang++, spitting out essentially error: array bound cannot deduced in-class initializer i understand standard says, there particular reason why? since have string literal seems compiler should able deduce size without problem, case when declare out-of-class const c-like null terminated string. the reason have possibility override in class initializer list in constructor. guess in end confusing. struct foo { foo() {} // str = "test\0"; // implementing easier if can see how big `str` is, foo() : str({'a','b', 'c', 'd'}) {} // str = "abcd0" const char str[] = "test"; }; notice replacing const char static constexpr works perfectly, , want anyway