Twitter | Pretraživanje | |
Jason Turner
9.959
Tweetovi
506
Pratim
9.895
Osobe koje vas prate
Tweetovi
Jason Turner 3 h
Odgovor korisniku/ci @thomasthomassen
/Wall isn't recommended by microsoft and their stdlib isn't clean with it, so /W4 + things on MSVC -Weverything maybe on clang if I can tolerate it with a few things disabled.
Reply Retweet Označi sa "sviđa mi se"
Jason Turner 5 h
Odgovor korisniku/ci @thomasthomassen
I'm pretty strict about it. Tests with good coverage, CI running with sanitizers, *all* warnings turned on, cppcheck, clang-tidy, etc. All of those things passing without warning
Reply Retweet Označi sa "sviđa mi se"
Jason Turner 5 h
Odgovor korisniku/ci @thomasthomassen
Personally, "Time To Market" or "Seeing Something Usable" is probably my very initial concern. I want to know what the road I'm going down makes sense, is viable, and is fun to play with. Then I very quickly want to switch to correctness.
Reply Retweet Označi sa "sviđa mi se"
Jason Turner 8 h
Odgovor korisniku/ci @shafikyaghmour @tloch14 i 2 ostali
the strict aliasing warning tools are not as good as I would like from gcc et al
Reply Retweet Označi sa "sviđa mi se"
Jason Turner 9 h
Odgovor korisniku/ci @tloch14 @rob_brink @tottinge
That example of mine was specifically in response to a question about how code can appear to work but be incorrect on closer examination
Reply Retweet Označi sa "sviđa mi se"
Jason Turner 9 h
Odgovor korisniku/ci @tloch14 @rob_brink @tottinge
Accessing an object after its lifetime has ended is in no way a strawman. You could argue it's slideware and over simplified, but it's the class of bug people deal with every day. If the memory has not yet been reused, it will appear to work.
Reply Retweet Označi sa "sviđa mi se"
Jason Turner 11 h
Odgovor korisniku/ci @rob_brink @tottinge
Example: Only an optimized build on GCC exposes the UB. Only an optimized build on GCC gives you the appropriate warning. All cases are UB. The code appears to work. It's subject to breaking with different versions of different compilers.
Reply Retweet Označi sa "sviđa mi se"
Jason Turner 11 h
Odgovor korisniku/ci @rob_brink @tottinge
Code that contains undefined behavior will appear to work in some situations and fail in others. Example: it may rely on the debugger default initializing values, or it may rely on objects being eliminated by the optimizer, all accidentally.
Reply Retweet Označi sa "sviđa mi se"
Jason Turner 11 h
Odgovor korisniku/ci @tottinge @rob_brink
Much code appears to work but on closer inspection does not actually.
Reply Retweet Označi sa "sviđa mi se"
Jason Turner 11 h
Odgovor korisniku/ci @AlisdairMered @BarryRevzin i 4 ostali
I'll have to admit I haven't followed the entire conversation but I know without doubt that this is correct int i; int &i_ref = i; std::cout << i_ref; // UB (read of uninitialized value) i = 42; // not UB (write to uninitialized value) std::cout << i_ref; // not UB (init now)
Reply Retweet Označi sa "sviđa mi se"
Jason Turner 12 h
Odgovor korisniku/ci @AlisdairMered @BarryRevzin i 4 ostali
cast-to-void (I believe) is guaranteed to be a no-op. Void types have no lifetime so it's impossible to invoke any kind of constructor/copy/etc.
Reply Retweet Označi sa "sviđa mi se"
Jason Turner 12 h
Odgovor korisniku/ci @bowie7070
Perhaps some people see beauty in correctness?
Reply Retweet Označi sa "sviđa mi se"
Jason Turner 12 h
Odgovor korisniku/ci @SeanParent @BarryRevzin i 4 ostali
Indeed. One of my favorite classes to teach involves *many* exercises around the order of construction/destruction/lifetime of objects. One of the things that makes statics annoying is the difficulty in knowing if their lifetime has begun yet or not and in what order.
Reply Retweet Označi sa "sviđa mi se"
Jason Turner 12 h
Odgovor korisniku/ci @BarryRevzin @AlisdairMered i 4 ostali
More to the point, if its lifetime hadn't begun you couldn't assign to it.
Reply Retweet Označi sa "sviđa mi se"
Jason Turner 12 h
Odgovor korisniku/ci @BarryRevzin @AlisdairMered i 4 ostali
Came here to add this comment, you beat me to it
Reply Retweet Označi sa "sviđa mi se"
Jason Turner 12 h
Odgovor korisniku/ci @BarryRevzin @AlisdairMered i 4 ostali
Yes, as far as I know always existed as well.
Reply Retweet Označi sa "sviđa mi se"
Jason Turner 14 h
Odgovor korisniku/ci @beached_whale @ben_deane
Never used in production as far as I know, but and I implemented a constexpr json parser in 2017.
Reply Retweet Označi sa "sviđa mi se"
Jason Turner 14 h
Odgovor korisniku/ci @shafikyaghmour @lectem i 2 ostali
I believe std::less also qualifies because of its ability to compare pointers into different objects?
Reply Retweet Označi sa "sviđa mi se"
Jason Turner 14 h
Odgovor korisniku/ci @OpDarkside
What do you do?
Reply Retweet Označi sa "sviđa mi se"
Jason Turner 14 h
Odgovor korisniku/ci @taw_moto
Maybe I should do another poll: * Beautiful Code * Readable Code * Maintainable Code * Clever Code. Just to see people's perceptions
Reply Retweet Označi sa "sviđa mi se"