The conversion to double rounds either up or down. C++ says it's implementation-defined which, but IEEE754's default rounding mode is Round-To-Nearest, which rounds up in this case, giving d == 2^63 exactly. The conversion back to m has UB due to being out of range for long long.
C++ quiz time! Assuming long long is 64 bits and double is IEEE754 double precision, what happens here:
long long n = 0x7fff'ffff'ffff'ffff;
double d = n;
long long m = d;
New C++ grammar ambiguity just dropped: godbolt.org/z/133c7fnos
Disambiguating between a C-style cast to a function type and a functional cast in parens can require statement / expression disambiguation to determine if you're parsing a lambda-expression or not.
I was in the room where it happened, because it happened to me. My name is Barbara Geller and I am one of the co-founders of the CopperSpice project. A horrifying incident happened on the last day of CppNow 2016 and this needs to be shared with the community. #cplusplus 1/
Really excited we've been able to start sharing our experimental work on #CarbonLang with the wider C++ community.
That said, I'd suggest folks read up on the docs and maaaybe wait for our announcement keynote and Q&A from #CppNorth before leaping to too many assumptions. =]
Carbon, a successor language to C++ was announced at @CppNorth today by @chandlerc1024.
I'm very excited about this project's potential. You can learn more about Carbon and get involved on GitHub.
github.com/carbon-language/c…
Carbon, a new successor language from @chandlerc1024, @zygoloid, @gregcons and friends presented at @CppNorth! The keynote recording should be released on YouTube in a few days! ❤️
Cute C++ trick of the day: a few odd quirks of C++ allow you to create a registry of atomically-modified global variables that spookily jump over unreachable code: godbolt.org/z/v75zdG4fb
(Idea: @zygoloid. Yes, this is horrifying. Advanced version here: godbolt.org/z/vns6n5aa3)
Something as simple and routine as a code review tool applying syntax highlighting will expose some of the attacks here. And unlike normal underhanded C, there is no plausible deniability in these attacks.
I find the claim that this attack is a vulnerability in programming languages is especially bizarre. This is a vulnerability in some code review tools, if they don't properly show the reviewer the proposed changes, not in the programming languages.
I'm a bit unhappy with the degree of hyperbole and unreasonable fear mongering going on with krebsonsecurity.com/2021/11/…
Interesting research, but it isn't new... Folks have been discussing unicode, bidi, and homoglyphs as forms of underhanded code bypassing review for many years.
x became associated with unknown quantities because the printer was running out of letter and choose x over y and z 🤯
From the book “Here’s Looking at Euclid”
#math