r/programminghorror • • Mar 25 '26

c System.out.print()

Post image
914 Upvotes

58 comments sorted by

View all comments

Show parent comment

1

u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live" Mar 25 '26

Maybe that's just C++, but I've heard that redefining keywords is UB. Though that might've been if any standard library headers are included after redefining a keyword.

2

u/MegaIng Mar 26 '26

Yeah, C++ apparently explicitly mentions this to be UB (redefining a keyword when you are including headers). C doesn't AFAIK, and in both redefining keywords itself is not directly problematic. (similar to how int x; itself is not problematic - it's only problematic if you don't assign a value before accessing it)