Morale of a story: ~ is the right choice for concat operator

Dukc ajieskola at gmail.com
Sat May 26 13:27:37 UTC 2018


On Saturday, 26 May 2018 at 12:37:15 UTC, rumbu wrote:
> Therefore your first example will work correctly if you convert 
> the int result back to char: (char)('a' + 'b') + "sssss" will 
> render the correct result.
>
> Even if C# would use '~' instead of '+', you had a type 
> conversion problem, not an operator problem, you wrongly 
> assumed that adding two chars will result in a char, not an 
> int. In the hypothetically code 'a' + 'b' ~ "sssss" is also 
> "195sssss".

I had to go back and check. Yes, it appears I screw up here. 
Sorry.

Sigh, this is one of the cases whereI wish I could edit my posts.


More information about the Digitalmars-d mailing list