We do have compiler warnings for implicit casts from bool to int.
@martinlicht71329 ай бұрын
The example on Slide 15 just shows the dangers of the implicit conversions introduced in C and adopted in C++. While it allows for very "concise" writing, ths s nt vr rdbl jst lk lvng t vwls in wrtng. Modern compilers should introduce flags optional warning about such accidental conversions even if they are perfectly valid C/C++.
@Carewolf9 ай бұрын
We might need an explicit "implicit" marker then.
@szaszm_2 ай бұрын
-Wconversion
@varshneydevansh9 ай бұрын
noice
@nyyakko9 ай бұрын
@ 25:05 I'd argue even more, you **should** keep it very minimal. Restrain yourself and prefer to declare only the minimal set of functions that is needed to make your class actually do the job it is intended to do. Tony Eard actually has a pretty good talk on this which goes more in depth, its a talk about the somewhat controversial SOLID principles. kzbin.info/www/bejne/nZ28omCaq8yVr5Y
@nyyakko9 ай бұрын
anyways, very great talk! it was fun to watch.
@elvircrn2 ай бұрын
12:38 Isn't a much nicer solution to just use a struct with designated initializers - a poor man's keyword arguments?