Remix.run Logo
machina_ex_deus 5 days ago

I would never have this typo as I usually delete the copy constructor in heavy structures.

colonwqbang 5 days ago | parent | next [-]

Do you ever use the C++ standard library? Most types have a copy ctor defined, also the really "heavy" ones.

lionkor 5 days ago | parent | prev [-]

this is the defensive and correct C++ approach, anyways.

Ygg2 5 days ago | parent [-]

Isn't that just same old "skill issue", "No True C(++) programmer" refrain?

If people could keep entirety of J.2 appendix in their mind at all time we would not have these issues. And if they had entirety of J appendix in mind all C code would be portable.

Or if people just always ran -Wall -Wpedantic -Wall_for_real_this_time -fsanitize=thread,memory,address,leaks,prayers,hopes,dreams,eldritch_beings,elder_gods -fno-omit-frame-pointer

I mean if this was all it took then C and C++ programs would be as safe as Rust. Which is not what we see in practice. And it's not like C programmers are an average web dev. It's a relatively niche and well versed community.

lionkor 4 days ago | parent [-]

Yes, it is the old "skill issue" argument.

When your language is that unsafe and difficult to hold correctly, you have to make sure that you at least try your very best.