タグ

cに関するniku_uchiのブックマーク (4)

  • Gitのつくりかた | メルカリエンジニアリング

    はじめまして。サーバサイドエンジニアの @DQNEO です。 今日はGitのつくりかたをご紹介します。 C言語学習教材としてのGit Gitと同じものをゼロから作って何の意味があるのか?と思いますよね。 私がこの再発明をやり始めた動機は「C言語を書けるようになりたい」でした。 実際に途中までやってみたところ、 C言語がチョットデキるようになった Gitの内部構造に詳しくなった というメリットが得られました。 C言語を勉強する題材は、テトリスとかWebサーバとか他にいくらでもあるのですが、Gitを実装してみるのはかなりおすすめです。理由は下記の通りです。 内部構造が意外と単純 (ローカルで動かす分には)ネットワークの知識が不要 普段使っているツールで外部仕様がわかっているので、やるべきことが明確 余談ですが、家Gitのソースコードを参考にしようと思って読んでいたら、Linus Tovals

    Gitのつくりかた | メルカリエンジニアリング
    niku_uchi
    niku_uchi 2015/09/14
  • CC500: a tiny self-hosting C compiler

    Introduction I wrote this tiny compiler, which translates a subset of C into x86 machine code, for fun. It has no use, unless it counts as educational. I called it CC500 because I initally guessed it would take about 500 lines. It turned out to be about 600 lines even without the comments and blank lines. With the comments and blank lines it has about 750 lines. It could be made shorter, but I wan

    niku_uchi
    niku_uchi 2014/11/18
  • Linux共有ライブラリの簡単なまとめ - wagavulinの日記

    Linuxで共有ライブラリ(*.so)を作るようになったのでちょっと勉強してみた。今までは使うだけだったので、以下のようなことは知っていた。作るときはgccの-sharedオプションを使う。使うときはgccの"-lライブラリ名"でリンクするライブラリを指定する。リンク時のライブラリ探索パスは-Lオプションで指定する。実行時のライブラリ探索パスは/etc/ld.so.confに書いてあるディレクトリ。環境変数LD_LIBRARY_PATHでも指定可能。ライブラリを作るときは、.cから.oを作るときに-fPICをつけるといいらしい。新しくライブラリを入れたときはldconfigするといいらしい。逆に今まであまり知らなかったこと。ほとんどのライブラリはlibhoge.so, libhoge.so.1, libhoge.so.1.1のように3つくらいのファイルがあり、libhoge.soやlibh

  • Which is faster: while(1) or while(2)?

    This was an interview question asked by a senior manager. Which is faster? while(1) { // Some code } or while(2) { //Some code } I said that both have the same execution speed, as the expression inside while should finally evaluate to true or false. In this case, both evaluate to true and there are no extra conditional instructions inside the while condition. So, both will have the same speed of e

    Which is faster: while(1) or while(2)?
  • 1