#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
#104 If the token defined is generated as a result of this replacement process or use of
the defined unary operator does not match one of the two specified forms prior to macro replacement, the
behavior is undefined: eel.is/c++draft/cpp.c…

godbolt: godbolt.org/z/xrdfT4 ImageImage
#105 If there are sequences of preprocessing tokens within the list of arguments to a function-like macro
that would otherwise act as preprocessing directives, the behavior is undefined: eel.is/c++draft/cpp.r…

godbolt: godbolt.org/z/6hfxn5 ImageImage
#106 If an invalid character results from using the stringize operator the behavior is undefined: eel.is/c++draft/cpp.s…

godbolt: godbolt.org/z/jsYbqP ImageImage
#107 If an invalid preprocessing token results from using the concat operator the behavior is undefined: eel.is/c++draft/cpp.c…

godbolt: godbolt.org/z/bqxMKe ImageImage
#108 Using 0 or a number greater than 2147483647 is undefined behavior for #line directive: eel.is/c++draft/cpp.l…

godbolt: godbolt.org/z/ccxcvW ImageImage
#109 When using the pptoken variant of the #line directive, If the directive resulting after all replacements does not match one of the two previous forms, the behavior is undefined.: eel.is/c++draft/cpp.l…

godbolt: godbolt.org/z/E5qvaa ImageImage
#110 If any of the pre-defined macro names in [cpp.predefined], or the identifier defined, is the subject of a #define or a #undef preprocessing directive, the behavior is undefined: eel.is/c++draft/cpp.p…

godbolt: godbolt.org/z/vEY5hz ImageImage
#111 Twist on use of indeterminate value causing undefined behavior.

Using an indeterminate value in a return statement causes the whole branch to be ignored and we just use the return statement at the end.

h/t @rep_stosq_void

godbolt: gcc.godbolt.org/z/nrjaa1 Image
#112 Falling off the end of a coroutine function body that does not return void is undefined behavior: eel.is/c++draft/stmt.…

godbolt: godbolt.org/z/5MTcnz Image
#113 Invoking a resumption member function for a coroutine that is not suspended results in undefined behavior: eel.is/c++draft/dcl.f…

godbolt: godbolt.org/z/W4PYfdPh4 Image
#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...
#116 If the substitution of template arguments into a requirement would always result in a substitution failure, the program is ill-formed; no diagnostic required: godbolt.org/z/eez98bfT5

[expr.prim.req]p5 eel.is/c++draft/expr.… template<typename T> concep...
#117 If, during parsing, lookup finds that a name in a template argument is bound to (part of) the declaration being parsed, the program is ill-formed. No diagnostic is required: godbolt.org/z/z354fnYGa

[stmt.ambig]p3 eel.is/c++draft/stmt.… #include <iostream> #includ...
#118 If no arguments to a constexpr function allow it to be used in a core constant expression context,
the program is ill-formed, no diagnostic required: godbolt.org/z/MdnsWe69E

[dcl.constexpr]p6 eel.is/c++draft/dcl.c… constexpr int f(bool b) { r...
#119 If no specialization of
the template would satisfy the requirements for a constexpr function when considered as a non-template
function, the template is ill-formed, no diagnostic required: godbolt.org/z/8rMd18rPj

[dcl.constexpr]p7 eel.is/c++draft/dcl.c… template <typename T> struc...
#120 If constinit is applied to any decl of a var, it shall be applied to the initializing decl. No diagnostic is required if no constinit declaration is reachable at the point of the initializing declaration: godbolt.org/z/bWMaTh8Ed

[dcl.constinit]p1 eel.is/c++draft/dcl.c… // Translation unit 1 exter...
#121 Some identifiers are reserved for use by C++ implementations and shall not be used otherwise; no
diagnostic is required: godbolt.org/z/658K4djY3

[lex.name]p3 eel.is/c++draft/lex.n… int _z;  int main() {     i...

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with The Grinch Who Gave Back Cursed Code

The Grinch Who Gave Back Cursed Code Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @shafikyaghmour

19 Sep
💯 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!
Read 4 tweets
18 Sep 20
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
@code_report "We write awful code" Image
Read 4 tweets
31 May 19
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
#2 Signed integer overflow/underflow is undefined behavior 2

int x3=std::numeric_limits<int>::min() / -1;

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

godbolt: godbolt.org/z/ytC8oi
Read 65 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!

:(