0

command center: Smiles

 2 years ago
source link: https://commandcenter.blogspot.com/2020/04/smiles.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Smiles

(Another resurrected post from the my old Google+ stream, which appeared on or about Dec 6, 2011.)

For unknown reasons, someone asked me if had a copy of this file today. I didn't, but I remembered it was in dmr's home directory, and asked a friend there to find it. I remembered correctly. I don't know why it was touched in 1993, but the .v (mips object file) was created in late 1992. I leave the significance of that date as an exercise for the reader.

By the way, sizeof(void) is illegal, so I'm unsure how it was compiled; my friend assures me the compilers from then didn't accept it either.

Because G+ refuses to leave the indentation alone and screws up the ls formatting, I'm posting a screen grab here, but i'll include the source code, poorly formatted and rudely scrubbed of indentation, so you can play with the bytes. Just for fun, after the first screen grab I'll post a second screen grab of this post in edit mode before I hit save.

#include <u.h>
#include <libc.h>

typedef int ☺☹☻;
typedef void ☹☺☻;
enum
{
    ☹☻☺ = sizeof(☺☹☻),
    ☻☺☹ = sizeof(☹☺☻),
};

☹☺☻
main(☹☺☻)
{
    ☺☹☻ ☺☻☹;

for(☺☻☹=☻☺☹; ☺☻☹<☹☻☺; ☺☻☹++)
        print("☺☻☹ = %d\n", ☺☻☹);
    exits(☻☺☹);
}

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK