Evan Teran
127 posts


@evan_teran @seanbax original `p` could be null
English

Hot tip💡
For safety, replace all your if-statements with ternary operators.
open-std.org/jtc1/sc22/wg21…

English

@seanbax But in both cases `p` stays unchecked... Is it unchecked more safely with the ternary operator?
English

@supahvee1234 I think @lefticus has an episode about this but can't remember the title. IIRC, there is a solution, but it's not pretty.
English

Has anyone else encountered this issue with `std::optional`? #cpp
"`std::optional` factory function with guaranteed copy elision and `private` constructor"
stackoverflow.com/questions/7858…
English

@supahvee1234 It's on github in a private repo, DM me and we can talk giving you access :-)
English

@wakomeup @ericniebler Tuple is usually done with trickery like structs which contain a elem and a struct for the next elem, and so on. It could be much better with a builtin. I suppose a compiler could make it emit something compatible with existing practice, seems like less of a win though :shrug:
English

@evan_teran @ericniebler Why would it be an ABI change? You'd just implement the built-in to be compatible. It would mean picking *which* library implementation to be compatible with, but there's an obvious choice for each compiler to implement its own tuple, i.e. gcc:libstdc++, clang:libc++, MSVC: MSVC.
English

@GoldonMarks @lefticus It absolutely CAN figure it out. The argument given is usually about if you see it, it's a promise from the writer that it WILL be constexpr, not that it can be if the compiler decides it can.
English

@lefticus why can't the compilers figure the constexpr out themselves, it's not funny to type specifiers anymore.
English

@seanbax Yeah, if the transform is aware of the f-string syntax, it could work for arbitrarily complex ones and "just work" hopefully.
English

@seanbax If you're asking for a PR... I can take a look when I have some free time 😜. But yeah, I'm just thinking that "hello {var}" could be transformed into std::format("hello {}", var) 👍 at compile time
English

@cmuratori I see your point, but there is a reason. Having the fields separate means that when your CC gets renewed vendors who have your # on file and only stored the 16 digits + a token they got from the initial auth can continue to charge it without the needing to update the info.
English

@WeThePeople516 @Xil_llix @Tesla @POTUS Wait? You're upset that the government is subsiding a specific private industry LESS?
Isn't that like, a stated goal of the Republican platform?
English

Unfortunately, the federal $7500 EV tax credit will end entirely for Model 3 RWD & Long Range delivered after 12/31.
Vehicles available for immediate delivery → tesla.com/inventory/new/…
Tesla@Tesla
Federal $7500 EV tax credit will reduce to $3750 for Model 3 RWD & Long Range on Jan 1, 2024. Take delivery by 12/31 for full tax credit → tesla.com
English

@janwilmans @lefticus @mattgodbolt Was about to chime in that it really shouldn't be a "law" as written, more of a "I should make sure that I didn't break anything" checkpoint. But you covered that in your follow up 👍
English

@lefticus @mattgodbolt Isn't this easily disproven by algorithmic changes?
let's say you run through a picture y-first and you flip the inner and outer loop to go x-first.
Suddenly your cache kicks into high gear and auto vectorization is triggered. I think I have seen 2-20x speedups this way?
English

I just had reason to quote Godbolt's Law - "if any single optimisation makes a routine run two or more times faster, then you’ve broken the code."
Re: @mattgodbolt
xania.org/200504/godbolt…
English

@atorstling @awesomekling Interesting, I have a completely opposite take. To me "we" says, I think the team/you should do this, and I'm willing to support helping make it happen.
Saying "you" is what I say to people subordinate to me when giving tasking.
English

@awesomekling This formulation is really common, but it's really getting on my nerves. People expressing opinions as questions isn't really helping IMO, they're not being transparent. I would vastly prefer: "My gut feeling is that this should be made reusable, did you already consider that?"
English

"Can we make this reusable?" is my current go-to 🤓
Brandon Roberts@brandontroberts
When you do code reviews, do you use "we" or "you" when proposing changes to a pull request? "We should make this reusable" vs "You should make this reusable" 🤔
English

@PMHomestead @NBCNews That's an excellent question.
The answer is mostly because Bill Clinton didn't do the same thing at all. Clinton paid a settlement as a matter of public record. No business records were falsified in the process, no funds were misappropriated.
English

@NBCNews I was wondering why Bill Clinton hadn't been charged when he did the same thing but while in office.
English

BREAKING: NBC News Special Report:
Manhattan District Attorney Alvin Bragg holds news conference following arraignment of former President Trump.
x.com/i/broadcasts/1…
English

@kinjalkishor @MarkusWerle @richgel999 @vzverovich C++ move isn't that complicated. Just because someone chose to write a book on its relatively simple rules doesn't mean that it was necessary to do so.
English

@evan_teran @MarkusWerle @richgel999 @vzverovich Rust move is one webpage (one rule default move, except if type has copy or clone trait)
doc.rust-lang.org/rust-by-exampl…
C++ std::move is one book with very complicated rules
amazon.com/Move-Semantics…
English

@kinjalkishor @MarkusWerle @richgel999 @vzverovich The vast majority of these new features are designed to make it so libraries can provide good APIs to the users. Most of the time, the users don't even need to know they exist.
English

@MarkusWerle @richgel999 @vzverovich Try python or rust sometime which have excellent libs, api interface and ease of use compared to C++
English

@meheleventyone @supahvee1234 @nicbarkeragain @cmuratori Also Casey's final code IMHO actually meets the criteria for most of the "clean code" principles he says he's avoiding. His final code: avoided ifs, was small, did one thing, and didn't repeat itself.
Basically ALL of the non simd gains could have been seen with std::variant
English

I think the key thing people are missing about @cmuratori ‘s “clean code” video is that there is a _measurable_ performance loss for a _non measurable_ maintainability gain. All the assertions of increased maintainability of “clean code” are just based on ~vibes~
English




