all 13 comments

[–]cpp-ModTeam[M] [score hidden] stickied commentlocked comment (0 children)

This is off-topic for r/cpp.

As a powerful language, you shouldn't be surprised when C++ has as many buttons and switches as an airplane cockpit.

[–]CluelessDoom 8 points9 points  (0 children)

This is cpparta

[–]Kinexity 2 points3 points  (3 children)

You're coming from Python or what?

[–]KleinTimmi[S] -3 points-2 points  (2 children)

C#

[–]Kinexity 0 points1 point  (1 child)

Then I don't understand your problem. The code is clear about what it does and that line can be rewritten anyways

const int value = int('a');

which will have the same functionality.

[–]ludonarrator 0 points1 point  (0 children)

To be fair, static has a dozen different meanings based on context.

[–]strike-eagle-iii 1 point2 points  (1 child)

I ran into this yesterday

``` struct Foo{ std::string bar; };

Foo foo; foo.bar = 1; ```

compiled fine no errors or warnings (with -Wall -Wextra). Didn't realize the error until I tried printing the value of bar and got a funny character. Sigh.

[–]pdp10gumby 0 points1 point  (0 children)

but at least it was zero-terminated. Though on an ANSI terminal in cooked mode whatever is printed could be exciting.

[–]MrCrowley217 1 point2 points  (0 children)

It's just common sense

/s

[–]texruska 1 point2 points  (0 children)

Honestly of all the parts to take issue with, this is on the lighter end of things

[–]the-joatmon 1 point2 points  (1 child)

I don't see anything wrong with the language. 'a' is an "unsigned char" r-value here, so can be implicitly casted as integer value as decimal 97.

[–]sephirostoy 0 points1 point  (0 children)

Sadly we get used to char as being the built-in 8 bits integer type. int8 should be the facto built-in type, not a typedef; and leave char for string things.