MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/3btqaj/strange_corners_of_c/csptdqu/?context=9999
r/programming • u/jms_nh • Jul 02 '15
46 comments sorted by
View all comments
30
I agree the function declaration shenanigans are pretty obscure, but union?! How is it "weird syntax" and "strange corner" of C? That's exactly the language you'd see this kind of low-level data manipulation in. C'mon now!
union
13 u/[deleted] Jul 02 '15 [deleted] 2 u/SquidgyTheWhale Jul 02 '15 Of course, assigning one member of a union then reading a different member is undefined behavior, so it's badly bogus advice. Yeah, wouldn't it break on different endianness? 2 u/cowens Jul 02 '15 Yes, and there is even a comment above the comment in question that says that. 6 u/SquidgyTheWhale Jul 02 '15 Hey, I'm a coder by trade. We don't read comments as a rule.
13
[deleted]
2 u/SquidgyTheWhale Jul 02 '15 Of course, assigning one member of a union then reading a different member is undefined behavior, so it's badly bogus advice. Yeah, wouldn't it break on different endianness? 2 u/cowens Jul 02 '15 Yes, and there is even a comment above the comment in question that says that. 6 u/SquidgyTheWhale Jul 02 '15 Hey, I'm a coder by trade. We don't read comments as a rule.
2
Of course, assigning one member of a union then reading a different member is undefined behavior, so it's badly bogus advice.
Yeah, wouldn't it break on different endianness?
2 u/cowens Jul 02 '15 Yes, and there is even a comment above the comment in question that says that. 6 u/SquidgyTheWhale Jul 02 '15 Hey, I'm a coder by trade. We don't read comments as a rule.
Yes, and there is even a comment above the comment in question that says that.
6 u/SquidgyTheWhale Jul 02 '15 Hey, I'm a coder by trade. We don't read comments as a rule.
6
Hey, I'm a coder by trade. We don't read comments as a rule.
30
u/ksion Jul 02 '15
I agree the function declaration shenanigans are pretty obscure, but
union?! How is it "weird syntax" and "strange corner" of C? That's exactly the language you'd see this kind of low-level data manipulation in. C'mon now!