TGViewer
Блог* Блог* @dereference_pointer_there · 1.98K subscribers
Post #10497 942
#prog #c #article #abnormalprogramming

Серия из трёх (на текущий момент) статей о странностях C

Weekend projects: getting silly with C
Getting silly with C, part (void*)2
Getting silly with C, part ~(~1<<1)

Наверное, мои самый любимые примеры кода из статей — это многострочный комментарий:

#include <stdio.h>

int main() {
puts("Hello world");
asm("/*");
/* Nested comment */
for (int i = 0; i < 10; i++) puts("I LIKE PANCAKES!");
asm("*/");
puts("Goodbye world");
}


и абьюз type punning-а на сигнатуре main для доставания "Главного ответа о вселенной, смысле жизни и всего такого" из воздуха:

#include <stdio.h>

int main(int i) {

do do do do "baby shark!";

while (++i % 2);
while (i == 2);
while (i % 3);
while (i % 7);

printf("The answer is %d.\n", i);

}
  • 😁 12
  • 👍 2
  • 🤯 2
  • 🍌 1
More from @dereference_pointer_there
  1. Oct 14, 2026r/rust (потому что написано вроде на Tauri)
  2. Oct 14, 2026advanced <...> technology such as a shopping cart
  3. Oct 14, 2026Source
  4. Oct 14, 2026#prog #rust #rustasync #article Tokio Gives Progress, Not Ordering: Scheduling 1M Tasks TL…
  5. Oct 14, 2026#game Slay the Spire 2
  6. Oct 13, 2026#prog #rust #suckassstory github.com/rust-lang/rust/issues/164250 use std::sync::Mutex; st…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →