r/cpp • • Apr 19 '20

Default function arguments are the devil

https://quuxplusone.github.io/blog/2020/04/18/default-function-arguments-are-the-devil/
88 Upvotes

149 comments sorted by

View all comments

Show parent comment

0

u/[deleted] Apr 19 '20

[deleted] — view deleted comment

9

u/TheThiefMaster C++latest fanatic (and game dev) Apr 19 '20

I fully agree - character types should require explicit conversion to integer types, and we should have a cleaner separation between size "1" integer types and characters

8

u/Supadoplex Apr 19 '20

character types should require explicit conversion to integer types

And presumably by extension: Character types should not be integer types.

7

u/_Js_Kc_ Apr 19 '20

Nor should this be a thing:

std::int8_t i = 65;
std::cout << i << '\n';

Prints A. Maybe.

-_-

2

u/warieth Apr 20 '20

Implicit conversions of many fundamental types inherited from C are the devil.

C++ didn't inherit conversions like bool -> int, char8_t -> int. These conversions make the usage of C functions easier, but coming from C++.