Удивительно, что доклад на такую, казалось бы, простую тему может длиться час. Но там действительно огромное поле для ошибок.
При написании алгоритма поиска среднего велик соблазн сделать просто return (a + b) / 2, однако такая реализация может переполниться и привести к неопределенному поведению.
Помимо переполнения есть еще другие сложности: integer promotion при работе с short, зависящий от имплементации знак у char. Ловушки в специализации шаблонов. А кроме целых типов ведь есть еще флоты и указатели, с которыми тоже приколов хватает.
Удивительно, что доклад на такую, казалось бы, простую тему может длиться час. Но там действительно огромное поле для ошибок.
При написании алгоритма поиска среднего велик соблазн сделать просто return (a + b) / 2, однако такая реализация может переполниться и привести к неопределенному поведению.
Помимо переполнения есть еще другие сложности: integer promotion при работе с short, зависящий от имплементации знак у char. Ловушки в специализации шаблонов. А кроме целых типов ведь есть еще флоты и указатели, с которыми тоже приколов хватает.
In a message on his Telegram channel recently recounting the episode, Durov wrote: "I lost my company and my home, but would do it again – without hesitation." Telegram users are able to send files of any type up to 2GB each and access them from any device, with no limit on cloud storage, which has made downloading files more popular on the platform. Given the pro-privacy stance of the platform, it’s taken as a given that it’ll be used for a number of reasons, not all of them good. And Telegram has been attached to a fair few scandals related to terrorism, sexual exploitation and crime. Back in 2015, Vox described Telegram as “ISIS’ app of choice,” saying that the platform’s real use is the ability to use channels to distribute material to large groups at once. Telegram has acted to remove public channels affiliated with terrorism, but Pavel Durov reiterated that he had no business snooping on private conversations. Messages are not fully encrypted by default. That means the company could, in theory, access the content of the messages, or be forced to hand over the data at the request of a government. The account, "War on Fakes," was created on February 24, the same day Russian President Vladimir Putin announced a "special military operation" and troops began invading Ukraine. The page is rife with disinformation, according to The Atlantic Council's Digital Forensic Research Lab, which studies digital extremism and published a report examining the channel.
from no