![未定義動作により最適化レベルで結果が変わるコード - Qiita](https://cdn-ak-scissors.b.st-hatena.com/image/square/acdd325be7aee0348482509717ed1929398a5002/height=288;version=1;width=512/https%3A%2F%2Fqiita-user-contents.imgix.net%2Fhttps%253A%252F%252Fcdn.qiita.com%252Fassets%252Fpublic%252Fadvent-calendar-ogp-background-f625e957b80c4bd8dd47b724be996090.jpg%3Fixlib%3Drb-4.0.0%26w%3D1200%26mark64%3DaHR0cHM6Ly9xaWl0YS11c2VyLWNvbnRlbnRzLmltZ2l4Lm5ldC9-dGV4dD9peGxpYj1yYi00LjAuMCZ3PTkxNiZoPTMzNiZ0eHQ9JUU2JTlDJUFBJUU1JUFFJTlBJUU3JUJFJUE5JUU1JThCJTk1JUU0JUJEJTlDJUUzJTgxJUFCJUUzJTgyJTg4JUUzJTgyJThBJUU2JTlDJTgwJUU5JTgxJUE5JUU1JThDJTk2JUUzJTgzJUFDJUUzJTgzJTk5JUUzJTgzJUFCJUUzJTgxJUE3JUU3JUI1JTkwJUU2JTlFJTlDJUUzJTgxJThDJUU1JUE0JTg5JUUzJTgyJThGJUUzJTgyJThCJUUzJTgyJUIzJUUzJTgzJUJDJUUzJTgzJTg5JnR4dC1jb2xvcj0lMjMzQTNDM0MmdHh0LWZvbnQ9SGlyYWdpbm8lMjBTYW5zJTIwVzYmdHh0LXNpemU9NTYmdHh0LWNsaXA9ZWxsaXBzaXMmdHh0LWFsaWduPWxlZnQlMkNtaWRkbGUmcz0zYWUxZWQ4ZTljN2FlOTQ2OGJmNzlmYzFmNjRmZmQ4Mg%26mark-x%3D142%26mark-y%3D151%26blend64%3DaHR0cHM6Ly9xaWl0YS11c2VyLWNvbnRlbnRzLmltZ2l4Lm5ldC9-dGV4dD9peGxpYj1yYi00LjAuMCZ3PTYxNiZ0eHQ9JTQwa2FpdHlvMjU2JnR4dC1jb2xvcj0lMjMzQTNDM0MmdHh0LWZvbnQ9SGlyYWdpbm8lMjBTYW5zJTIwVzYmdHh0LXNpemU9MzYmdHh0LWFsaWduPWxlZnQlMkN0b3Amcz02Mjg2NmFlN2IwNmUwODllNTI0NjNkOWFjMGU1YTc3Ng%26blend-x%3D142%26blend-y%3D491%26blend-mode%3Dnormal%26s%3Deea47a119498d8e2b2fb52c742a241cb)
Rob Pike February 21, 1989 Introduction Kernighan and Plauger's The Elements of Programming Style was an important and rightly influential book. But sometimes I feel its concise rules were taken as a cookbook approach to good style instead of the succinct expression of a philosophy they were meant to be. If the book claims that variable names should be chosen meaningfully, doesn't it then follow
Making the HTTP server run 20% faster by using qrintf-gcc; a sprintf-optimizing preprocessor / compiler tl;dr This is an initial release announcement of qrintf, a preprocessor (and qrintf-gcc is the compiler frontend) that optimizes calls to sprintf and snprintf. C programs calling the functions may run faster by using the preprocessor / compiler in place of the standard compiler toolchain. Backgr
普通のやつらの下を行け: C でバックトレース表示 普通のやつらの下を行けの第2回として、今回は glibc の関数を使って C でバックトレース (スタックトレース) の表示を行ってみます。 バックトレースとは バックトレースとは、大ざっぱに言うと、現在の関数に至るまでの道筋です。たとえば、次の Ruby プログラムを実行すると、 1 / 0 の行で例外が発生して、バックトレースの表示とともにプログラムは異常終了します。 def foo 1 / 0 end def main foo end main この例では main から foo を呼び foo の中の 1 / 0 の部分で例外が発生しています。 % ruby divide-by-zero.rb divide-by-zero.rb:2:in `/': divided by 0 (ZeroDivisionError) from div
デモ ニコニコ動画の伝説の動画 「テトリスを1時間強で作ってみた【実況解説】」という動画をご存知でしょうか? 2009年にニコニコ動画で公開されて話題になった動画です。 インタビュー記事:「テトリスを1時間強で作ってみた」動画の投稿者にインタビュー──「プログラミングの楽しさ伝えたい」 この動画ではテトリスをいちから作ってわずか62分で完成させています。 しかし実はスタート直後はMinGWのインストール、EmEditorのインストールに続いてブロック画像の作成などをしており、プログラミングが始まるのは開始13分のところからです。 さらに次の10分は「空のウィンドウ」を作るために時間を使っており、実質的にテトリスのプログラミングが始まるのは動画23分のところからです。 つまり、実質的に40分のプログラミングでテトリスを完成させています。 で、動画を見ながら同じようにやれば誰でもテトリスを作れ
Should volatile Acquire Atomicity and Thread Visibility Semantics? Traditionally, the semantics of C's and C++'s volatile keyword have been unclear. In particular, these languages state that operations are "evaluated strictly according to the rules of the abstract machine" (C99, 6.7.3-6) But, at least in the pthread context, this has generally not been interpreted to apply to inter-thread visibili
C/C++でポインタ変数を宣言するときの*記号をint* a;のように左寄せで書くか、int *a;のように右寄せで書くか。 右寄せで書く場合、「Cでは宣言と使用の文法を一致させる」という規則から考えれば素直に解釈できるという話。
Programming is hard. Programming correct C and C++ is particularly hard. Indeed, both in C and certainly in C++, it is uncommon to see a screenful containing only well defined and conforming code.Why do professional programmers write code like this? Because most programmers do not have a deep understanding of the language they are using.While they sometimes know that certain things are undefined o
The Cyclone programming language was intended to be a safe dialect of the C language. It avoids buffer overflows and other vulnerabilities that are possible in C programs by design, without losing the power and convenience of C as a tool for system programming. It is no longer supported by its original developers, with the reference tooling not supporting 64-bit platforms. The Rust language is men
Top 10 C Language resources that will turn you into a better programmer - C and C++ Programming Resources 今更 C 言語かと言われそうだが、Linux カーネルだって、我々が利用している LL 言語の多くだってこの言語で書かれているのである。ワタシ自身は未だどの言語よりCを愛している。 以下に C 言語に関してウェブに公開されている代表的なリソースを挙げていく。さすがに更新が長らく止まっているものが多いが、それでも有用な情報源には違いない。ネタ元は Hacker News。 C Programming Notes Programming in C - UNIX System Calls and Subroutines using C. C Lesson by Chris Sawtell
たとえば libevent のような C 言語でかかれたイベント駆動型のライブラリを C++ から使っていると、C++ のメンバ関数をコールバックとしてセットできたらうれしいことが多いですよね。以下のようにすればできます。 たとえば、コールバック関数をセットする関数の型が、 void set_foo_callback(void (*)(void* cb_arg), void* cb_arg); なら、以下のようにクラスとメンバ関数を引数にとるテンプレート関数を定義し、 template <typename T, void (T::*FUNC)()> void to_foo_callback(void* cb_arg) { T* obj = reinterpret_cast<T*>(cb_arg); (obj->*FUNC)(); }以下のように受け渡せばいい。 class K { publ
2002 | 10 | 11 | 12 2003 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 2004 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 2005 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 2006 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 2007 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 2008 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 2009 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 1
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く