ときどきの雑記帖 RE* (新南口)
いつか猫になる日まで
Bug?
VisualStudio 2019 (cl.exe) のバグっぽい挙動 - Qiita
まあバグなのは間違いないと思うけど
>ruby -e "(1..6).each{puts (1<<30)*_1}"
1073741824
2147483648
3221225472
4294967296
5368709120
6442450944
>ruby -e "(1..6).each{puts (1<<30)*_1&0xffff_ffff}"
1073741824
2147483648
3221225472
0
1073741824
2147483648
後者で0になっているところのsizeofの結果が4なのは最低でもint分の大きさはあるから。ということか?
Motorola S Record
MC68000エミュレータの開発 その6 - レトロパソコンであそぼう!
名前を見て「ああ、インテルHEX形式のモトローラ版?」とピンときた。中身を見て確信。
「ソニーのファミコン」みたいな響きだ>インテルHEX形式のモトローラ版
We also killed K&R declarations and definitions and made foo() mean that it takes no arguments
以前 Perl code that is syntactically correct only on Fridays で
Cでいうところの func(void) と func()の違いですね (って「最近」変わったんだっけ?(調べない))。
とか書いたのですが、西亭新九郎が暗躍していたのかこんな話題を見つけてしまった。
C23でtrue/falseがkeywordに。
— 高梨陣平 (@jingbay) February 19, 2022
K&Rの宣言が遂に亡くなった。foo()は引数無しの関数で確定。
- "\U12967849" is illegal (too-big for 21 bit code point) https://t.co/wlWJyfHRT0
ここからツイートを辿り、辿り、
C meeting is over. C23 added the follow: https://t.co/HKumw91WEs Comments: https://t.co/EUpDVuogMo
— Hacker News (@HNTweets) February 19, 2022
さらにスレッドになっているものを追いかけていくと
これか!
他にもいろいろ書かれていて、興味深いものもいくつか。
まーたずいぶんと変えますわねえ… C meeting is over. C23 added: | Hacker News でも結構な盛り上がりっぷり。
C
Cと言えば以前こんな話題も。
標準化されたCはOSの開発には向いてない (PLOS'21論文)。ISO標準はあまりに抽象化されており、ほとんどのOSはコンパイラ依存の仕様に頼っている。そして未定義動作を最大限活用したコンパイラによる最適化がある。多くの場合、これら最適化によるメリットはさほど大きくない。https://t.co/Sn3BfijR6x
— 新山祐介 (Yusuke Shinyama) (@mootastic) January 21, 2022
ISO標準がなんでOS開発に適さないかというと、未定義動作による(特にgccによる)アグレッシブな最適化が、システムの安全性を損なう割に最大で16%くらいしか性能に貢献していないようだから、なのか
— zehnpaard (@zehnpaard) January 21, 2022
Coqで形式検証されたCompCertの話も出ていて面白かった https://t.co/C7FdxxdgES
Hash as data structure
英語版の連想配列(Associative Array)の Wikipedia にはしつこいくらい Hash table と書いてあるのになぜ日本の「連想配列」の Wikipedia には「ハッシュ(英語: hash)、マップ(英語: map)とも呼ばれる」と書かれてしまったんだろう。https://t.co/cWeJP2sTHF
— mattn (@mattn_jp) February 21, 2022
ただ Perl の古いドキュメント(英語)とか見ても hash (perl-hash) て呼んでるんよね。どこからそうなっちゃったんだろう。
— mattn (@mattn_jp) February 21, 2022
common lisp に、要素を取り出す gethash、要素を削除する remhash があるな。歴史的にどっちが先か知らんけど。
— mattn (@mattn_jp) February 21, 2022
Perl がハッシュって呼ばれるようになった経緯が…https://t.co/G24qOAdhvk https://t.co/4xsYtJksR2
— かりやみつらない 3042798775655 (@kariya_mitsuru) February 21, 2022
「「ハッシュ」という用語はハッシュテーブルがそれらを実装するために使用されているという事実に由来しています」 なるほど🤔 https://t.co/s826yLOypq
— mattn (@mattn_jp) February 21, 2022
mattnさんでもご存じなかったのか……
Perlのドキュメントでいわゆる「連想配列(associative array)」を「ハッシュ(Hash)」と呼ぶようになったのは 5.0からなので、古いドキュメントと言ってもPerl4やさらにその前のドキュメントを見ないといけないのでした。 perldocには5より前のはないし、無理もないけど。
そして、リプライでLearning Perlの次のような記述を参照しているけど (なんかリンク(サイト)が怪しいので直接リンクは貼らないでおく)、
[121]In the olden days, we called these “associative arrays.” But the Perl community decided in about 1995 this was too many letters to type and too many syllables to say, so we changed the name to “hashes.”
これはこれで間違いではないのだけど、 Programming Perlの第2版と第4版(第2版は日本語訳が「改訂版」として出版されていた)には なぜそういう名前にしたかがもう少し詳しく書かれている (なぜ第3版にないのかは不明)。
O’ReillyのSafariにアクセスできる人なら第4版を見られると思うけど 内容を引用(というか転載か)するとこんな感じ。 ルー語的訳はつけないでもいいでしょ。
p.10
Hashes A hash is an unordered set of scalars, accessed *9 by some string value that is associated with each scalar. For this reason hashes are often called associative arrays. But that’s too long for lazy typists, and we talk about them so often that we decided to name them something short and snappy. The other reason we picked the name “hash” is to emphasize the fact that they’re disordered. (They are, coincidentally, implemented internally using a hash-table lookup, which is why hashes are so fast and stay so fast no matter how many values you put into them.) You can’t push or pop a hash, though, because it doesn’t make sense. A hash has no beginning or end. Nevertheless, hashes are extremely powerful and useful. Until you start thinking in terms of hashes, you aren’t really thinking in Perl. Figure 1-1 shows the ordered elements of an array and the unordered (but named) elements of a hash.
- Or keyed, or indexed, or subscripted, or looked up. Take your pick.
p.84
Hashes As we said earlier, a hash is just a funny kind of array in which you look values up using key strings instead of numbers. A hash defines associations between keys and values, so hashes are often called associative arrays by people who are not lazy typists
Glossary p.1046
associative array See hash. Please. The term associative array is the old Perl 4 term for a hash. Some languages call it a dictionary.
p.1059
hash An unordered association of key/value pairs, stored such that you can easily use a string key to look up its associated data value. This glossary is like a hash, where the word to be defined is the key and the definition is the value. A hash is also sometimes septisyllabically called an “associative array”, which is a pretty good reason for simply calling it a “hash” instead.
つまりはそういうことです。
ところで第4版でも
出版社 : O’Reilly Media; Fourth版 (2012/3/13)
ほぼ10年前なんですな(ひー)。
Hugoメモ
レイアウト
- レイアウト用のテンプレートの種類を理解する | まくまくHugo/Goノート
- HugoのLayoutについて理解する-プログラミングを中心に、現役web系エンジニアが興味を持ったことを徒然と書いていきます
- Hugo のレイアウトの仕組み - Marbles Day
- Layouts in Hugo | Hugo tutorial | CloudCannon