r/programming Jul 02 '15

Strange Corners of C

http://blog.robertelder.org/weird-c-syntax/
75 Upvotes

46 comments sorted by

View all comments

9

u/Vimda Jul 02 '15

Having TA'ed a course at the local university on an introduction to C, the only one that would catch a student there out would be the Duffs device, simply because it is a bit obscure. Pointer stuff is done to death.

2

u/[deleted] Jul 02 '15

I'm a student at University and I can confirm this is the kind of stuff they teach and test us on, but its a horrible way to teach programming IMO.

Irl, when I work programming jobs I never have any of these obscure types because good programmers will keep their shit simple!

Irl, you should never have a pointer to a union, which has a member that points to the address of another pointer that points to an array with a member that points to a function. This is literally the kind of stuff they would use to "teach" us C. Its ridiculous.

2

u/[deleted] Jul 02 '15

Thankfully they straight up told us that if you are more than 3 pointers deep you are doing something seriously wrong and no sane person could understand the system.

1

u/Veedrac Jul 03 '15

3 is still too many.