@shafik@hachyderm.io Profile picture
Compiler Engineer clang front end. Interests: C++, C, and undefined behavior. Martial Artist, Book Worm and Dad. @shafik@hachyderm.io he/him
Sep 19, 2021 4 tweets 2 min read
💯 Cursed code

Same code compiles in both C and C++ and can detect which version of C and C++ with language features alone.

With not be taking questions.

#cplusplus
#programming #if true #define ISC 0 #els... I have added this to my github "determine_c_or_cpp" repo: github.com/shafik/determi…

Enjoy!
Apr 4, 2021 10 tweets 8 min read
#114 Invoking destroy() on a coroutine that is not suspended is undefined behavior: eel.is/c++draft/dcl.f…

godbolt: godbolt.org/z/3sWf3czPs godbolt screen shot of coro... #115 Calling a function through an expression whose function type is different from the function type of the called function’s definition results in undefined behavior: godbolt.org/z/snjzbh6oc

[expr.call]p6 eel.is/c++draft/expr.… using f_float = int (*)(flo...
Jan 24, 2021 20 tweets 17 min read
#102 The result of an infinite recursion in template instantiation is undefined behavior: eel.is/c++draft/temp.…

godbolt: godbolt.org/z/jh6bsr Image #103 Referring to any non-static member or base class of an object in the handler for a function-try-block of a
constructor or destructor for that object results in undefined behavior: eel.is/c++draft/excep…

godbolt: godbolt.org/z/6Yzvvc Image
Sep 18, 2020 4 tweets 3 min read
Structure and Interpretation of Computer Programs: SICP
By @code_report

Why SICP matters?

#CppCon
#Cplusplus Image @code_report Pascal is for building pyramids

Lisp is for building organisms Image
May 31, 2019 65 tweets 50 min read
Let’s do this:

One Like, One Undefined Behavior.

I plan on running this through the weekend at least.

#Cplusplus
#Programming Signed integer overflow/underflow is undefined behavior

int x1=std::numeric_limits<int>::max()+1;
int x2=std::numeric_limits<int>::min()-1;

[expr.pre]p4 eel.is/c++draft/expr#…

godbolt: godbolt.org/z/Ga-fbb