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.

Uhurx

From Esolang
Jump to navigation Jump to search

Uhurx is an esolang invented by User:None1. Because the author ran out of names for esolangs, he simply generated a name randomly. This esolangs is especially good at causing undefined behavior.

Memory

It has only one unsigned 64-bit integer x. It's uninitialized, so its initial value is an undefined garbage value.

Commands

  • *: Read the address x and store the result into x.
  • !: Set x to a random 64-bit integer.
  • ?: Set x to 0.
  • ~: Set x to the reciprocal of x.

Examples

Division by zero

?~

Segmentation fault

*

Segmentation fault 2

?*

Segmentation fault 3

!*

Interpeter

C

#include<stdio.h>
#include<stdlib.h>
unsigned long long randnum(){
 unsigned long long r=0;
 for(int i=0;i<64;i++)r=r<<1|rand()&1;
 return r;
}
int main(){
 unsigned long long x;
 char c;
 while((c=getchar())!=EOF){
  switch(c){
   case '*':x=*((unsigned long long*)x);break;
   case '!':x=randnum();break;
   case '?':x=0;break;
   case '~':x=1ull/x;break;
  }
 }
 return 0;
}

See also