Title
/dev/krzaq
Go Home
Category
Description
Address
Phone Number
+1 609-831-2326 (US) | Message me
Site Icon
/dev/krzaq
Tags
Page Views
0
Share
Update Time
2022-10-26 10:29:46

"I love /dev/krzaq"

www.krzaq.cc VS www.gqak.com

2022-10-26 10:29:46

/dev/krzaqRSSFacebookTwitterShow sidebar...TagsCC++C++03C++11C++14C++17C++ quizC89C quizcrackmeDiablo 2ilvl viewerkeygenmemathsQtreviewrubytriviaMiscellaneous linksWeb frontend for clang-formatAbout meDigital Ocean reflinkStandardsB language referenceC89 draftN1256 (C99)N1570 (C11)N3337 (C++11)N3337 (C++11) on-lineN4140 (C++14)N4140 (C++14) on-lineN4659 (C++17)N4659 (C++17) on-lineOnline compilerscodepadColiru EditorGCC Explorerideone三へ( へ՞ਊ ՞)へ ハッハッRecommended blogs (EN)Andrzej's C++ blogBartek's coding blogEli Bendersky's websiteFabien Sanglard's WebsiteFlaming DangerzoneGrowing up (a programming blog)gynvael.coldwind//vxhasherezade's 1001 nightsJean Guegant's blogkatafrakt.melitb's blogPVS-Studio's blogReWolf's blogSimon Brand (@TartanLlama)Solarian ProgrammerSutter’s MillThe Old New ThingThiago Macieira's blogRecommended blogs (PL)dev::pingwindyktator (under construction)gynvael.coldwind//vxMy Polish BlogAdventures in returning value-dependent type2020-05-202020-05-20 krzaq1 CommentA few nights ago a friend asked me if I had any idea how to make his magic macro work. The general idea behind it was simple: for strings known at the compile time, return type parametrized on the string hash; otherwise return a runtime type. He even provided the type trait he uses to determine if we’re dealing with a string literal. It works well for his case and its potential wrongness is not the point of this article.The point was something else: let us define a macro NAME and classes Const and Runtime, such that the following is valid code:std::string runtime;std::cin >> runtime;auto c = NAME("KrzaQ");auto r = NAME(runtime);// 9546715638267443724UL is fnv1a64("KrzaQ");static_assert(std::is_same{});static_assert(std::is_same{});std::string runtime;std::cin >> runtime;auto c = NAME("KrzaQ");auto r = NAME(runtime);// 9546715638267443724UL is fnv1a64("KrzaQ");static_assert(std::is_same{});static_assert(std::is_same{});Always willing to help, I sat down to show him how the C++20 solution would like, then how to do a simple tag-dispatch, and to see if the macro could be replaced with a function call.Or so I thought.Read MoreProper digit separators in C++2018-04-012018-04-01 krzaq5 CommentsHave you ever hoped that C++ would have digit separators? That you wouldn’t have to strain your eyes when reading 2147483647 (is it std::numeric_limits::max(), or is it just similar)? That you wouldn’t have to count the zeros 5 times when typing 1000000000?Well, the C++ Standards Committee doesn’t have your back. Oh, sure, they have introduced a digit separator, – ‘, but it’s completely unusable in production code! Here’s why.Read MoreBook review: Game Engine Black Book: Wolfenstein 3D2018-02-142018-02-13 krzaq3 CommentsI’ve been a fan of Fabien Sanglard’s website and, more accurately, his phenomenal code reviews of older games for quite some time now – if you don’t know what I mean, follow the link above and check for yourself. Naturally, I was very excited to learn about him writing a book. So much, in fact, that I considered pre-ordering it, which goes against my core beliefs. In the end, I didn’t pre-order1, but that was only because I wanted a signed copy (and I got one much more personalized than I dared to hope for). Game Engine Black BookRead MoreCode doodles #5 – quite surprising parse2017-07-312017-08-01 krzaq2 CommentsI came upon a similar piece of code during an IRC discussion. While I am certain that some may consider this example trivial, I admit that the correct answer eluded me even after I verified the result with the compiler – it wasn’t until I checked the standard that it became clear.Consider the following class:struct foo{ foo() { cout