We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Undefined behavior (language)

From Esolang
Jump to navigation Jump to search

Undefined behavior is a language where everything is undefined.

Literally. There is no specification.

Known UB programs

Due to the nature of the language, most programs will not have the intended behaviour in most implementations.

'ubtxt' (Undefined Behavior Text)

Hello, World!

   STATEMENT WHOSE BEHAVIOR IS ACTUALLY DEFINED
   IN AN UNDEFINED WAY, SET THE REGISTER 1 TO THE UNDEFINED VALUE // sets reg 1 to 0 or sometimes 255
   SET REGISTER 1 TO THY ZERO
   ASSIGN TO REGISTER_MULTI 1 TO LENGTH_OF STRING Hello, World! /STRING /LENGTH_OF /REGISTER_MULTI THE VALUE STRING Hello, World! /STRING // the only way that works with most compilers
   PRINT REGISTER_MULTI 1 TO LENGTH_OF STRING Hello, World! /STRING /LENGTH_OF /REGISTER_MULTI

Implementations

By definition, any program is a valid implementation of this language.