News for hackers. Stuff that matters.
Re:You can't make C++ not ugly, but you can't not try (2010) by klingonopera on Thursday February 27, 2020 @03:03AM (#22431522)
> "Using the "+" operator with two string constants gives a weird compiler error about adding pointers?"

He'd have that in C too, and that's the expected behaviour. What he would want is:

  #define STRING1 "hello"
  #define STRING2 "world"
  const char* gString = STRING1 " " STRING2 "!\n";
  #include <stdio.h>
  int main() {printf(gString); return 0x0;}
Re:You can't make C++ not ugly, but you can't not try (2010) by AstralStorm on Thursday February 27, 2020 @04:09AM (#22431798)
If you make them string constants rather than character arrays with the new literal ""s added in C++14, problem is gone. Author is using outdated C++.

This is all due to C compatibility.

Re:You can't make C++ not ugly, but you can't not try (2010) by klingonopera on Thursday February 27, 2020 @04:12AM (#22431808)
Ah, yeah... no clue about C++'s strings, I just read his question and that sounded familiar to the problem, whose solution I posted above.

There's some overlap between C and C++, but maybe this wasn't such a case? Sorry, if it was uncalled for.