139.59.169.82 Open in urlscan Pro
139.59.169.82  Public Scan

URL: https://139.59.169.82/
Submission Tags: krdtest
Submission: On February 28 via api from JP — Scanned from JP

Form analysis 1 forms found in the DOM

GET https://dev.krzaq.cc/

<form role="search" method="get" id="searchform" action="https://dev.krzaq.cc/"><input type="search" name="s" class="search" placeholder="Type and hit enter..."></form>

Text Content

/DEV/KRZAQ

RSS Facebook Twitter

Show sidebar...


TAGS

C C++ C++03 C++11 C++14 C++17 C++ quiz C89 C quiz crackme Diablo 2 ilvl viewer
keygenme maths Qt review ruby trivia


MISCELLANEOUS LINKS

 * Web frontend for clang-format
 * About me
 * Digital Ocean reflink


STANDARDS

 * B language reference
 * C89 draft
 * N1256 (C99)
 * N1570 (C11)
 * N3337 (C++11)
 * N3337 (C++11) on-line
 * N4140 (C++14)
 * N4140 (C++14) on-line
 * N4659 (C++17)
 * N4659 (C++17) on-line


ONLINE COMPILERS

 * codepad
 * Coliru Editor
 * GCC Explorer
 * ideone
 * 三へ( へ՞ਊ ՞)へ ハッハッ


RECOMMENDED BLOGS (EN)

 * Andrzej's C++ blog
 * Bartek's coding blog
 * Eli Bendersky's website
 * Fabien Sanglard's Website
 * Flaming Dangerzone
 * Growing up (a programming blog)
 * gynvael.coldwind//vx
 * hasherezade's 1001 nights
 * Jean Guegant's blog
 * katafrakt.me
 * litb's blog
 * PVS-Studio's blog
 * ReWolf's blog
 * Simon Brand (@TartanLlama)
 * Solarian Programmer
 * Sutter’s Mill
 * The Old New Thing
 * Thiago Macieira's blog


RECOMMENDED BLOGS (PL)

 * dev::pingwindyktator (under construction)
 * gynvael.coldwind//vx
 * My Polish Blog


ADVENTURES IN RETURNING VALUE-DEPENDENT TYPE

2020-05-202020-05-20 krzaq 1 Comment

A 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<size_t> 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<decltype(c), Const<9546715638267443724UL>>{});
static_assert(std::is_same<decltype(r), Runtime<std::string>>{});

std::string runtime; std::cin >> runtime; auto c = NAME("KrzaQ"); auto r =
NAME(runtime); // 9546715638267443724UL is fnv1a64("KrzaQ");
static_assert(std::is_same<decltype(c), Const<9546715638267443724UL>>{});
static_assert(std::is_same<decltype(r), Runtime<std::string>>{});

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 More


PROPER DIGIT SEPARATORS IN C++

2018-04-012018-04-01 krzaq 5 Comments

Have 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<int32_t>::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 More


BOOK REVIEW: GAME ENGINE BLACK BOOK: WOLFENSTEIN 3D

2018-02-142018-02-13 krzaq 3 Comments

I’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 Book
Read More


CODE DOODLES #5 – QUITE SURPRISING PARSE

2017-07-312017-08-01 krzaq 2 Comments

I 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 << __PRETTY_FUNCTION__ << endl;
    }
 
    foo(int)
    {
        cout << __PRETTY_FUNCTION__ << endl;
    }
};

struct foo { foo() { cout << __PRETTY_FUNCTION__ << endl; } foo(int) { cout <<
__PRETTY_FUNCTION__ << endl; } };

And now, consider the following code:

int global;
int main()
{
    foo();
    foo(42);
    foo(global);
}

int global; int main() { foo(); foo(42); foo(global); }

Would you care to guess what will be printed?

Read More


YOU DON’T NEED A STATEFUL DELETER IN YOUR UNIQUE_PTR (USUALLY)

2017-06-262017-06-26 krzaq 4 Comments

With the increasing probability of your average project using at least C++11,
std::unique_ptr is one of the most popular solutions1 to dynamically managing
memory in C++.

It usually goes like this: if your object can’t be a scoped object, that is one
with automatic lifetime (colloquially: on the stack, or a class’s member), wrap
it in std::unique_ptr. This will ensure it’s freed when it finally goes out of
scope. Herb Sutter goes more in-depth into this topic in his last C++Con talk:

Herb Sutter: Leak-Freedom in C++… By Default.

This advice is sound and deserves being spread.

Read More


POSTS NAVIGATION

Older posts
© 2022 /dev/krzaq | Theme: Storto by CrestaProject WordPress Themes. Modified by
KrzaQ. | 39 queries, 0.198 seconds.