並び順

ブックマーク数

期間指定

  • から
  • まで

1 - 3 件 / 3件

新着順 人気順

c++の検索結果1 - 3 件 / 3件

  • C++erは全員戻り値型の後置記法を使おう - ペイントソフト開発日誌

    目次 目次 「戻り値型の後置記法」って何? 何が嬉しいの? 問題点 「戻り値型の後置記法」って何? C++11から導入された言語仕様です。 タイトルの呼び方は自分が勝手に使っているだけで、英語圏だと「trailing-return-type」がよく使われるらしい。 cpprefjp.github.io この仕様を使うと例えば以下のようなコードが int Add(int a, int b) { return a + b; } このようになります。 auto Add(int a, int b) -> int { return a + b; } 何が嬉しいの? この仕様はC++のメタプログラミングで戻り値型の推論を簡単に行う目的で使用されます。 なんだ、そんなC++上級者のための機能なんて下々の人間には関係ないじゃん、とお思いかもしれませんが、この機能にはもう一つわかりやすい大きなメリットがある

      C++erは全員戻り値型の後置記法を使おう - ペイントソフト開発日誌
    • Exploring the c4... compiler?

      This week I found myself digging through the code of c4, an implementation of C “in four functions”, by Robert Swierczek. I remember coming across c4 when it was released ten years ago. It got me excited: hey, C in four functions, that means it’s easy to understand right? That excitement turned into “oh, I see” as soon as I scrolled through the code. c4 is dense, barely commented, and, frankly, st

        Exploring the c4... compiler?
      • Compiling higher order functions with GADTs

        Implementing first class functions in a bytecode interpreter is trivial. But how do compilers that generate machine code (or lower to C, or SSA) implement higher order functions? Back in 2021, I found an answer when contributing closures to the Pallene compiler. Today I was researching something loosely related, and found yet another neat trick called defunctionalization in this paper. Defunctiona

        1