Category: Uncategorized
-
Const Correctness Taken Out of C++!
Hi guys, please take note of a major development in C++ world. Read it at the link below. https://shaovoon.github.io/article/const.html
-
Windows Toast Notification
Looking to implement Windows Toast Notification for your C++ application? Want to know how I fixed memory leaks in WinToast (updated 15 Feb 2022)? Look no further than this article.
-
Quiz: Guess What These x86 Assembly Instructions Execute
Interested to find out what these assembly instructions with the same source and destination operands do? XOR EAX, EAX TEST EBX, EBX MOV EDI, EDI
-
Find GDI Leaks With Windows Debugger
Come in to read my article Find GDI Leaks With Windows Debugger at CodeProject
-
Deleaker detects resource leaks in StackOverflow answer
Recently, I need to capture the mouse cursor in my homebrew screen capture application, so my search sent me to StackOverflow’s Capture screen shot with mouse cursor. Out of curiosity, I ran Deleaker on it and it finds 2 HBITMAP leaks with every capture. My application captures mouse cursor 30 times per second, so the […]
-
Anti-Pattern: Enum as Array Index with No Bound Check
Recently, I encountered program crashes because of unscoped enum as array index pattern once in the workplace and another in an open source library where I added another item in the enum. Evidently, this anti-pattern is very popular among C++ developers. Open source code using Enum as Array Index pattern without bound check in its […]
-
Put sleep() to make more money from HFT. And Lock-free vs Block-free
“Isn’t April Fools over?” the very first thought running through your mind after glancing at the title. Rest assured, this is not a trolling post to make a fool out of you. This year’s April Fool post is here, in case you missed the once-in-a-lifetime C++ joke of its kind. This article is about slowing […]
-
C++23: -> and :: to be replaced by . operator
In the biggest change to C++ syntax, -> and :: operators are to be replaced by . operator in the upcoming C++23 AF00L proposal. The rationale behind this proposal is there can be no confusion (as to which operator to use). The :: operator is not only used in scope resolution and also as class-to-static_member. […]
-
Modernizing Raytracing In A Weekend
Ray Tracing In A Weekend Repo My Modernized Ray Tracing In A Weekend Repo The improvements I made to the original code: Convert all raw allocation to shared_ptr to prevent memory leaks. Replace non-reentrant rand() with a copy of C++11 random number generator in every thread using thread_local to avoid sharing and locking. Replace the […]
-
CreateCertificateContext Failed
CertCreateCertificateContext failure can be fixed with first exporting the certificate to DER Encoded Binary X.509 (cer file) manually. std::vector<BYTE> vec; PCCERT_CONTEXT pCertContext = NULL; if (pCertContext = ::CertCreateCertificateContext( PKCS_7_ASN_ENCODING | X509_ASN_ENCODING, vec.data(), vec.size())) { std::cout << “Success!\n”; } else { std::cout << “Failure!\n”; } If one want to forgo the manual export option, CryptQueryObject can […]