💾 Archived View for tilde.pink › ~irek › log › 20240211.gmi captured on 2024-05-10 at 12:22:26. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2024-03-21)

-=-=-=-=-=-=-

2024.02.11 Sun 09:32 Hello world without a strings in C

There is commonly shared opinion that null terminated strings are bad. Mainly because of all those buffer overflow hacks but also people find them hard to work with. C programming language is criticized for it as null termination is the default goto solution for strings in C standard library. You don't have to use null terminated strings if you forsake standard library.

Anyway, who need strings, right? The REAL PROGRAMMERS [1] only work with numbers. And so with 3 integers you can have the one and only - General Kenobi!

$ cat -n hello-there.c
     1	int main(void) {
     2		int write(int,void*,int);
     3		int msg[]={0x6c6c6548,0x6854206f,0x0a657265};
     4		return write(1,msg,sizeof(msg)) < 0;
     5	}
$ gcc hello-there.c && ./a.out
Hello There

I CHALLENGE YOU 🫵 TO WRITE A CRAZIER VERSION!

Too simple for your taste? Well then, be my guest and create more obfuscated hello world program using those secret forbidden dark side techniques. You have my permission.

[1] Real Programmers