Live data from Hacker News

Paged Out #9 [pdf]

pagedout.institute

11–20 of 33 posts

Re: Paged Out #9 [pdf]

#12
Fun fact - the computiles piece is an uncredited rediscovery of Wang's work from the 1960's on computable tilings. Specifically, he went as far to show that the halting problem is equivalent to the 'domino problem' - can we tile the plane using a given finite set of dominoes (aka tiles) where we have infinitely many copies of each and the tiling must preserve edge-meet criteria. Every tiling is a computer program, every computer program is a tiling.

Re: Paged Out #9 [pdf]

#13

Fun fact - the computiles piece is an uncredited rediscovery of Wang's work from the 1960's on computable tilings. Specifically, he went as far to show that the halting problem is equivalent to the 'domino problem' - can we tile the plane using a given finite set of dominoes (aka tiles) where we have infinitely many copies of each and the tiling must preserve edge-meet criteria. Every tiling is a computer program, ev…

It’s credited in section 3

Re: Paged Out #9 [pdf]

#14
post #3

I like page 30: The Subpixel Zoo . It must be hell for text rendering: https://en.wikipedia.org/wiki/Subpixel_rendering

Desktop OSes just assume the vertical subtiles (at best with an option between RGB and BGR). TVs and mobile devices don't generally support subpixel rendering at all.

Re: Paged Out #9 [pdf]

#15
post #3

I like page 30: The Subpixel Zoo . It must be hell for text rendering: https://en.wikipedia.org/wiki/Subpixel_rendering

Sorry, we moved this. It's on page 37 now - "Hardware" section works better for this one than "Food for thought".

https://pagedout.institute/webview.php?issue=9&page=37&artic...

Re: Paged Out #9 [pdf]

#17
post #4

Michał Zalewski's article on page 42 is very funny.

Would someone be interested in explaining what in the world is going on in that article?

I'll try to do the first one since I think it's the most illustrative:

  1  long typedef[[]]*($)(void*($),...);  
  2  int main() {  
  3   char* str = "Hello, world.";  
  4   $ $ asm("puts");  
  5   $:&&$&&$(str);  
  6  }

(1) is equivalent to "typedef long* $(void*, ...)". '$' is the name of the defined function type.

it's obfuscated as follows:

- typedef is a specifier and can go on either side of the type, same as int const/const int

- [[ ]] is an empty list of attributes

- "void*($)" is an argument named '$' of type void*, but parameter names are ignored in declarations.

- you can put parens in declarations since sometimes you need to group prefixes and postfixes in a different order

- dollar signs in names are allowed in many c compilers (and some other c-like languages)

- "..." are variadic arguments. puts doesn't have those, but the first argument uses the same register either way so it happens to work out in this case

(4) declares a function named '$' of type '$', shadowing the type, and links it to the assembly label "puts". calling $ calls puts.

normally it looks like `int call_foo(void) asm("foo");`

(5) is parsed as: "label $: address-of-label $ and function $ called on str. the address of a label is truthy, so the function also gets called.

unary && looks for the argument in the label namespace, but other operators don't, so the two dollars refer to different things.

that's about it. if you're familiar with the c standard and some common gnu extentions, you can deconstruct the examples into their basic elements easily enough

Re: Paged Out #9 [pdf]

#20
post #9

Earlier quoted context omitted.

Would someone be interested in explaining what in the world is going on in that article?

What do you mean? It's just simple beginner's examples in C. Should be easy enough to understand, C is famously very simple ('portable assembler' as they say!).

> In our experience, C has proven to be a pleasant, expressive and versatile language for a wide variety of programs. It is easy to learn, and it wears well as one's experience with it grows.

The C Programming Language K&R

Post reply on HN