Quantcast
Channel: c – Gea-Suan Lin's BLOG
Browsing all 57 articles
Browse latest View live

Golang 的排序演算法將換成 pdqsort,LLVM libc++ 換成 BlockQuicksort

在 Hacker News 首頁上看到的消息,Golang 將會把 sort.Sort() 換成 pdqsort (Pattern-defeating Quicksort):「Go will use pdqsort in next release (github.com/golang)」,對應的 commit 則是在「sort: use pdqsort」這邊可以看到。 然後另外是「Changing...

View Article


Image may be NSFW.
Clik here to view.

從簡單的 C 語言函式來看現代 Compiler 使用 SIMD 的威力

兩個禮拜前在 Hacker News Daily 上看到這篇很精彩的問題與分析,裡面展現出了現代 compiler 最佳化的能力,大量使用了 SIMD 來衝效能:「Why does this code execute more slowly after strength-reducing multiplications? (stackoverflow.com)」,原文在 Stack Overflow...

View Article


Decompile to C 的工具

昨天在 Hacker News 上看到「Decompiler Explorer (dogbolt.org)」這篇,裡面列出了很多 Decompile to C 的工具 (就不用直接硬看 assembly),包括了 open source 與商用軟體: angr (BSD-2-Clause)。 Binary Ninja (商業軟體) Boomerang (BSD-3-Clause) Ghidra...

View Article

Image may be NSFW.
Clik here to view.

月份傳回值 0 表示一月的考古

Hacker News 上看到「History of Zero-Based Months? (jefftk.com)」這篇,在考古為什麼常常看到 function 在傳回「月份」時是以 0 表示一月。從這篇提到的「Why is day of the month 1-indexed but the month is 0-indexed in C?...

View Article

歐盟 2024 年年底強制使用 USB-C 充電頭 (終於,iPhone...)

Hacker News Daily 上看到「EU Passes Law to Switch iPhone to USB-C by End of 2024」,裡面指到了歐盟的新聞稿:「Long-awaited common charger for mobile devices will be a reality in 2024」。 2024 年年底 (所以是 2025 年) 將強制手機與平板都使用...

View Article


C 語言裡面的 ??! 符號

在 Hacker News Daily 上看到這個奇怪的知識:「What does the ??!??! operator do in C? (stackoverflow.com)」,原文在 Stack Overflow 上:「What does the ??!??! operator do in C?」。 這是 trigraph,在 C89 就有了,從 Rationale for...

View Article

calloc() 與 malloc() 的差異

前陣子在 Hacker News Daily 上看到的,原文是 2016 的文章:「Why does calloc exist?」,裡面講的東西包括了 implementation dependent 的項目,所以要注意一下他的結論未必適用於所有的平台與情境。 malloc() 與 calloc() 的用法是這樣,其中 calloc() 會申請 count 個 size 的空間: void*...

View Article

AWS 官方推出了自己的 Amazon S3 FUSE 套件

看到「Mountpoint for Amazon S3」這個專案,AWS 自己推出了自己的 Amazon S3 FUSE 套件。Hacker News 上也有一些討論:「Mountpoint – file client for S3 written in Rust, from AWS (github.com/awslabs)」。 Amazon S3 的價錢比其他 AWS 提供的 storage...

View Article


ClickHouse 弄了一個 C++ 寫的 ZooKeeper drop-in replacement:ClickHouse Keeper

在 Hacker News 上看到「ClickHouse Keeper: A ZooKeeper alternative written in C++ (clickhouse.com)」,原文是「ClickHouse Keeper: A ZooKeeper alternative written in C++」。 在 distributed coordination 這個領域目前應該是 etcd...

View Article


Raspberry Pi 5 的一些細節出現了...

上一篇「Raspberry Pi 5」提到了一些來自 Raspberry Pi 官方的說明,後續各個媒體 (像是 YouTuber) 也都解禁放出不少資料可以參考了,其中電源的部分在「Answering some questions about the Raspberry Pi 5」這邊看到不認 USB PD 的 5V/5A 的問題,目前看起來是走獨規: I also tested the...

View Article

Image may be NSFW.
Clik here to view.

從 Google Groups 送出來的 spam 數量稍微下降...

先前在「Google Groups 的巨量 spam」這邊提到從 Google Groups 倒進 usenet 大量的 spam,最近看起來稍微緩解了一些。 這是 10/22 的量: 這是 10/29 的量: 可以看出來整體被 Perl filter 擋下來的量大幅降低了,在 comp.lang.c 也可以看出來 10/28 後似乎暫時停了...? 只能繼續觀察看看了...

View Article

Image may be NSFW.
Clik here to view.

用 Astrometa DVB-T2 收數位無線電視台 (DVB-T)

以前用的 USB 電視棒壞掉了,去網拍上找了一隻新的來用,翻了一下跟 LinuxTVWiki 上的 Astrometa DVB-T2 這頁的圖片一樣 (2014 版本的圖): 先講一下重點,如果你買到的 USB 電視棒跟我一樣,應該可以看到兩個 source 可以收 DVB-T,而這兩個 source 都可以測試看看,在我家裡測試 Sony CXD2837ER 的收訊明顯好很多:...

View Article

Image may be NSFW.
Clik here to view.

C++ 實作高頻交易程式的技巧

看到「C++ patterns for low-latency applications including high-frequency trading (arxiv.org)」這篇,原文是 2023 年九月上傳到 arXiv 的 paper:「C++ Design Patterns for Low-latency Applications Including High-frequency...

View Article


用 C 語言寫 Android 版本的 Flappy Bird

也是在 Hacker News Daily 上看到的專案,用 C 寫的 Android 版本的 Flappy Bird,而且支援度還頗廣的,Android 5.1+ 都可以執行:「VadimBoev/FlappyBird」。 看起來也因為這篇的關係,用 C 寫 Android 程式的計畫也被再次貼到 Hacker News 上:「Rawdrawandroid – Build Android apps...

View Article

用 C-Reduce 找問題 (包括了程式的問題以及可能的 compiler 問題)

上個禮拜看到「You can use C-Reduce for any language (bernsteinbear.com)」這個,原文「You can use C-Reduce for any language」在說 C-Reduce 可以用在很多語言。 不過我光是 C-Reduce 用在 C 語言的情況都不確定了,就翻翻看有沒有範例可以先了解 C-Reduce...

View Article


POSIX 以及 ISO C 規格中的 fread() 與 fwrite() 限制

在 Lobsters 看到「I Thought I Found a Bug...」這篇,裡面提到了 POSIX 以及 ISO C 標準的 fread() 與 fwrite() 其實有個討厭的限制。 在使用 fopen() 時可以指定使用 update mode (+,像是 r+、w+ 以及 a+) 開啟,然後可以針對這個 FILE * 讀寫: fp = fopen("/tmp/foo.txt",...

View Article

snac:用 C 寫的 ActivityPub instance

前幾天看到 snac 這個專案,用 C 寫的 ActivityPub instance。 看起來連 SQLite 都沒用到,直接拿 filesystem 的結構來存資料,然後也完全沒用 javascript,另外有提到有支援一些 Mastodon 的 API。 然後... 專案名稱 snac 的全名是 Social Networks Are Crap (???),是個看起來頗有趣的專案 XD

View Article

Browsing all 57 articles
Browse latest View live