Warning: mkdir(): No space left on device in /var/www/group-telegram/post.php on line 37

Warning: file_put_contents(aCache/aDaily/post/misha_writes_code/--): Failed to open stream: No such file or directory in /var/www/group-telegram/post.php on line 50
Миша пишет код | Telegram Webview: misha_writes_code/210 -
Telegram Group & Telegram Channel
Копался в случайных issues на гитхабе и нашел интересное обсуждение:
https://github.com/rust-lang/rust/issues/28728

TLDR:
Раст ловил ошибки в бесконечных циклах из-за того, что LLVM привык выкидывать такие циклы в плюсах.

Чуть более развернуто:

Компилятор C++ в некоторых случаях может выбрасывать бесконечные циклы. Все к этому привыкли и пугают детей вот такими примерами с УБ: https://godbolt.org/z/KKa34Mjar.

Но в программах на Rust не бывает УБ*, бесконечные циклы разрешены и поэтому примеры с УБ (раз) (два) пугают уже не только детей.

Ошибки выше обусловлены тем, что LLVM, которым компилируется и Rust, и C++, выбрасывал бесконечные циклы, так как считал, что выполнение программы должно к чему-то приводить.

Проблема в итоге починилась в 2021 году спустя 6 лет после обнаружения в расте и спустя 15! лет после обнаружения в си. Решением стало добавление атрибута mustprogress в LLVM IR для циклов в языках с forward progress guarantee.

Интересно, кстати, что в расте предлагалось добавлять

unsafe {asm!("" :::: "volatile")}

к циклам, чтобы создать side effect, запрещающий компилятору выбрасывать бесконечные циклы.

Мораль:
Ты можешь быть бесконечно без УБ, но какой в этом толк, если твой программист плачет

P.S.
Еще всякие рандомные ссылки, которые я нашел, пока разбирался:

1. Forward progress guarantees: Base definitions
2. Why undefined behavior for infinite loops
3. The as-if rule
4. C Compilers Disprove Fermat’s Last Theorem
5. Trivial infinite loops are not Undefined Behavior



group-telegram.com/misha_writes_code/210
Create:
Last Update:

Копался в случайных issues на гитхабе и нашел интересное обсуждение:
https://github.com/rust-lang/rust/issues/28728

TLDR:
Раст ловил ошибки в бесконечных циклах из-за того, что LLVM привык выкидывать такие циклы в плюсах.

Чуть более развернуто:

Компилятор C++ в некоторых случаях может выбрасывать бесконечные циклы. Все к этому привыкли и пугают детей вот такими примерами с УБ: https://godbolt.org/z/KKa34Mjar.

Но в программах на Rust не бывает УБ*, бесконечные циклы разрешены и поэтому примеры с УБ (раз) (два) пугают уже не только детей.

Ошибки выше обусловлены тем, что LLVM, которым компилируется и Rust, и C++, выбрасывал бесконечные циклы, так как считал, что выполнение программы должно к чему-то приводить.

Проблема в итоге починилась в 2021 году спустя 6 лет после обнаружения в расте и спустя 15! лет после обнаружения в си. Решением стало добавление атрибута mustprogress в LLVM IR для циклов в языках с forward progress guarantee.

Интересно, кстати, что в расте предлагалось добавлять


unsafe {asm!("" :::: "volatile")}

к циклам, чтобы создать side effect, запрещающий компилятору выбрасывать бесконечные циклы.

Мораль:
Ты можешь быть бесконечно без УБ, но какой в этом толк, если твой программист плачет

P.S.
Еще всякие рандомные ссылки, которые я нашел, пока разбирался:

1. Forward progress guarantees: Base definitions
2. Why undefined behavior for infinite loops
3. The as-if rule
4. C Compilers Disprove Fermat’s Last Theorem
5. Trivial infinite loops are not Undefined Behavior

BY Миша пишет код


Warning: Undefined variable $i in /var/www/group-telegram/post.php on line 260

Share with your friend now:
group-telegram.com/misha_writes_code/210

View MORE
Open in Telegram


Telegram | DID YOU KNOW?

Date: |

Pavel Durov, a billionaire who embraces an all-black wardrobe and is often compared to the character Neo from "the Matrix," funds Telegram through his personal wealth and debt financing. And despite being one of the world's most popular tech companies, Telegram reportedly has only about 30 employees who defer to Durov for most major decisions about the platform. Continuing its crackdown against entities allegedly involved in a front-running scam using messaging app Telegram, Sebi on Thursday carried out search and seizure operations at the premises of eight entities in multiple locations across the country. He said that since his platform does not have the capacity to check all channels, it may restrict some in Russia and Ukraine "for the duration of the conflict," but then reversed course hours later after many users complained that Telegram was an important source of information. Ukrainian forces successfully attacked Russian vehicles in the capital city of Kyiv thanks to a public tip made through the encrypted messaging app Telegram, Ukraine's top law-enforcement agency said on Tuesday. "We're seeing really dramatic moves, and it's all really tied to Ukraine right now, and in a secondary way, in terms of interest rates," Octavio Marenzi, CEO of Opimas, told Yahoo Finance Live on Thursday. "This war in Ukraine is going to give the Fed the ammunition, the cover that it needs, to not raise interest rates too quickly. And I think Jay Powell is a very tepid sort of inflation fighter and he's not going to do as much as he needs to do to get that under control. And this seems like an excuse to kick the can further down the road still and not do too much too soon."
from tw


Telegram Миша пишет код
FROM American