随笔分类 - C/C++
摘要:#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <limits.h> namespace abc { // abc: the basic facts about a part
阅读全文
摘要:666行的象棋程序下得不错啊 | 印刷用棋盘工具带源码 (MFC, 约150行) | 浏览器里的中国象棋 JavaFx WebView使用研究 | JavaFX WebView and WebEngine Tutorial | JNI 入门教程 What options are available
阅读全文
摘要:Chapter 5. Counting Bits - Hacker’s Delight, Second Edition [Book] (oreilly.com) The IBM Stretch computer (about 1960) had a means of counting the num
阅读全文
摘要:#pragma GCC diagnostic ignored "-Wunused-parameter"和#pragma GCC diagnostic ignored "-Wdeprecated-declarations"极其有用 Suppressing Warnings in GCC and Cla
阅读全文
摘要:Alpha-Beta算法“见好就收”不再搜。| 博弈树搜索 | 贪心算法 | 666行的象棋程序下得不错啊 可运行的代码如下: #include <stdio.h> #include <vector> struct { int score; char* kids; } nodes[] = { { 0
阅读全文
摘要:全部666行(不计最后空行),不是只有界面。界面很简陋: b2c5写错了,应为b2b9炮七进七打马。截图不改了。9级就是9秒。没空格的如c3c47也行(7秒)。 源码就一个.cpp: #include <stdio.h> #include <stdlib.h> #include <string.h>
阅读全文
摘要:这可烦人了: short i = 1, j = 2; i += j; // warning C4244: '+=' : conversion from 'int' to 'short', possible loss of data (VC6 Warning Level 4) 还是VC6, cl /W
阅读全文
摘要:With some clever use of shared ring buffers, io_uring performance is really memory-bound, since in polling mode, we can do away with system calls alto
阅读全文
摘要:What exactly is std::atomic? Is a = a + 12 the entire operation, add_twelve_to(int) atomic? Or are changes made to the variable atomic, operator=() ?
阅读全文
摘要:strict weak ordering导致公司级故障 - 高性能架构探索 - 博客园 std::sort - cppreference.com std::less - cppreference.com cppreference.com不说人话,只好先看: Partial and Total Ord
阅读全文
摘要:搞了个比较极端的测试: 64KB长的字符串里找不到: #include <stdio.h> #include <time.h> // MinGW does not build against glibc, it builds against msvcrt. As such, it uses libm
阅读全文
摘要:gcc -w -c espresso.h 2021/12/29 23:07 18,915 espresso.h2021/12/29 23:12 1,561,284 espresso.h.gch To create a precompiled header file, simply compile i
阅读全文
摘要:Structured Exception Handling (C/C++) | Microsoft Docs 结构化异常处理 (SEH) 是 Microsoft 对 C 的扩展……尽管 Windows 和 Microsoft c + + 支持 SEH,但建议使用 ISO 标准 C++ 异常处理。 t
阅读全文
摘要:大量C++书籍下载: c++ 20: free download. Ebooks library. On-line books store on Bookzz 大量机器学习书籍下载: machine learning: free download. Ebooks library. On-line b
阅读全文
摘要:main h1=00000000 h2=00000000 main h1=009B0048 h2=00000000 main h1=009B0048 h2=009C0078 main h1=009B0048 h2=009C0078 coroutine: 0 @ 009B005C coroutine:
阅读全文
摘要:真正干事的是__builtin_coro_done, __builtin_coro_resume和__builtin_coro_destroy, coroutine_handle只是在void*外面包了一层。它没有析构函数,得去调destroy(). 它重载了(), h()等于h.resume()等
阅读全文
摘要:test_and_set是这个意思: /* UINT32& u = hb[h >> 5]; const UINT32 m = 1 << (h & 0x1f); const UINT32 seen = u & m; u |= m; // test_and_set */ #include <iostre
阅读全文
摘要:超快只是和我自己用python写的比而已。再写搜索就剁手。g++ -O3 pushbox.cpp Sorry,起个耸人听闻的标题骗点击。 // @ = man; $ = box; * = goal; # = wall; floor is represented by ' ', '-' or '_'
阅读全文
摘要:#include <vector> #include <stdio.h> struct X : public std::vector<int> { void print() const { printf("%p ", this); } }; void fn1(X x) { x.print(); }
阅读全文
摘要:有时候加载X.dll失败,而它明明就在那里。原因可能是X.dll用了Y.dll,而Y.dll不在。 dumpbin/imports可看到某个.exe或.dll用了哪些.dll。dumpbin/?看帮助。 dumpbin.exe需要link.exe, link.exe需要mspdb60.dll。下面的
阅读全文