I've seen some bad C code in my time, but never anything like this!

Man, I'm glad I learned ANSI C [1] instead of K&R C [2], if only to avoid egregious code like:

>
```
#define bitblt(s, r, d, p, c) (*((void(*)())0x430d6))(s, r, d, p, c)
```

Via Reddit [3], “Rob Pike on Twitter [4]”

I shudder to think of the toolchain where casting an integer to a function address is easier than linking [5] to the function.

[1] https://en.wikipedia.org/wiki/ANSI_C

[2] https://en.wikipedia.org/wiki/C_(programming_language)#K.26R_C

[3] https://www.reddit.com/r/C_Programming/comments/3f3i7w/cast_to_function

[4] https://twitter.com/rob_pike/status/626538319237681152

[5] https://en.wikipedia.org/wiki/Linker_(computing)

Gemini Mention this post

Contact the author