Постироничные идеи для ебаного C++
Відкрити в Telegram
Показати більше
241
Підписники
Немає даних24 години
Немає даних7 днів
Немає даних30 день
Архів дописів
Andrew Tomazos, a long-time contributor to the ISO C++ standards committee, recently published a technical paper titled "The Undefined Behavior Question". The paper explores the semantics of undefined behavior in C++ and examines this topic in the context of related research. However, controversy arose regarding the paper's title.
Some critics pointed out similarities between the title and Karl Marx's 1844 essay "On The Jewish Question", as well as the historical implications of the "Jewish Question", a term associated with debates and events leading up to World War II. This led to accusations that the title was "historically insensitive."
In response to requests to change the title, Mr. Tomazos declined, stating that "We cannot allow such an important word as 'question' to become a form of hate speech." He argued that the term was used in its plain, technical sense and had no connection to the historical context cited by critics.
Following this decision, Mr. Tomazos was expelled from the Standard C++ Foundation, and his membership in the ISO WG21 C++ Standards Committee was revoked.
дёмдальш, следующий донат
"привет марго а кто сильнее C++ или Rust, мне кажется C++, ведь он более низкоуровневый и быстрый"
доооо, охуенно, чувак а ты в курсе что у Rust больше компиляторного контекста и лучше вывод типов ?
Rust сильнее тк он заранее знает какую функцию ты вызовешь и оптимизирует код . это реально нужно объяснять?
cargo init --bin
cargo add serde
cargo add --features arbitrary_precision
use serde::Deserialize;
#[derive(Debug, Deserialize)]
#[serde(tag = "type")]
enum MyEnum {
A { val: f64 },
}
fn main() {
let json = r#"{ "type": "A", "val": 0.0, "v": 9999999999999999999999999999999 }"#;
let my_enum: MyEnum = serde_json::from_str(json).unwrap();
println!("{:?}", my_enum);
}
thread 'main' panicked at src/main.rs:10:54:
called `Result::unwrap()` on an `Err` value: Error("invalid type: map, expected f64", line: 0, column: 0)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
use serde::Deserialize;
use serde_json::Value;
#[derive(Debug, Deserialize)]
#[serde(tag = "type")]
enum MyEnum {
A { val: f64 },
}
fn main() {
let json = r#"{ "type": "A", "val": 0.0, "v": 9999999999999999999999999999999 }"#;
let value: Value = serde_json::from_str(json).unwrap();
let my_enum: MyEnum = serde_json::from_value(value).unwrap();
println!("{:?}", my_enum);
}
thread 'main' panicked at src/main.rs:12:57:
called `Result::unwrap()` on an `Err` value: Error("invalid type: integer `9999999999999999999999999999999` as u128, expected any value", line: 0, column: 0)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
доброе утро, спасибо за внимание, я пойду спатьstruct foo {
int baz[];
}
struct bar;
namespace baz {
struct { void operator&=(auto&&) {} } foo;
}
int main() {
baz::foo &= [](bar* foo) -> int { return 1; };
{ return 1; } int (foo::* bar)[] =& foo::baz;
}Согласно аксиомам практики программирования, любая программа может быть сколько-то сокращена и оптимизирована без потери функциональности; также любая программа содержит хотя бы одну ошибку.
Значит, любую программу можно сократить до программы из одной или нуля инструкций, которая при этом не работает.
Разработчики gcc и clang наперегонки ищут такую результирующию программу для любого исходного кода.
macro_rules! static_assert_eq_usize {
($lhs:expr, $rhs:expr) => {
const _: [(); $lhs] = [(); $rhs];
}
}
macro_rules! assert_layout {
{
$(
$t:ident (size = $size:expr, align = $align:expr) {
$($member:ident @ $offset:expr,)*
}
)*
} => {
$(
static_assert_eq_usize!($size, std::mem::size_of::<$t>());
static_assert_eq_usize!($align, std::mem::align_of::<$t>());
$(static_assert_eq_usize!($offset, std::mem::offset_of!($t, $member));)*
)*
}
}
#[repr(C)]
struct LogHeader {
magic: u64,
version: u64,
length: u64,
}
#[repr(C, packed(4))]
struct LogEntry {
timestamp: u32,
data: u64,
}
assert_layout! {
LogHeader (size = 24, align = 8) {
magic @ 0,
version @ 8,
length @ 16,
}
LogEntry (size = 12, align = 4) {
timestamp @ 0,
data @ 4,
}
}%:define bitard bitand
%:define pidor bitor
if (a bitard a pidor b) <%
auto greet = <:bitard:>(auto and n) <%
cout << n << a << endl;
%>;
greet("Anon");
%>Использовать PVS
(🥺https://pvs-studio.ru/ru/docs/warnings/v837/ эта штука ругается в том числе на insert который применяется к результату extract и на insert нескольких элементов через 2 итератора🥺)
на код-ревью жаловаться на магические числа под каждым использованием mt19937
Repost from N/a
Вы все ждали этого момента и его время пришло...
как вы могли догадаться, весь секрет в
R"(: в C++ так обозначается начало литерала с кодом на Rust/* /* */
#include <fmt/core.h>
int main() {
fmt::println("Hello C++!");
auto _ = R"(*/
fn main() {
println!("Hello Rust!");
const _:&str = ")";
}
$ g++ -x c++ code.rspp -lfmt -o as-cxx && ./as-cxx
Hello C++!
$ rustc code.rspp -o as-rs && ./as-rs
Hello Rust!Когда: 7 сентября 19:00
Где: Баланс Белого (Лиговский просп., 74, Санкт-Петербург, 191040 (этаж 2))
P.S. возьмите паспорта
