Moving the kernel to modern C
Moving the kernel to modern C
Posted Mar 4, 2022 15:59 UTC (Fri) by dvdeug (guest, #10998)In reply to: Moving the kernel to modern C by wtarreau
Parent article: Moving the kernel to modern C
In all the programming languages under discussion, 3 + 1 returns 4. In mathematics, a + b is an arbitrary function, almost always associative and commutative; 3 + 1 can equal 0, in Z mod 4. I've certainly seen + used as a concatenation operator in real life, like in rebuses.
> if the code was not constantly cheating on them doing nasty tricks that do not ressemble what it seems to do. That's the same reason why many developers perfer to use upper case for macros. It's a signal that you should look it up and that it might evaluate your arguments more than once, for example.
Non-hygenic macros are insane. Had you said
> That's exactly why I despise [C's macro system]. You cannot trust anymore what you're reading.
I wouldn't have disagreed. So why the difference? Why can developers be trusted with macros and not operator overloading?
Posted Mar 4, 2022 17:02 UTC (Fri)
by marcH (subscriber, #57642)
[Link]
> Why can developers be trusted with macros and not operator overloading?
They can't with either. No one likes the pre-processor. It's always seen as a necessary evil to work around C's limitations. Macros are subject to especially high review scrutiny and new ones can be introduced only if they solve a very generic problem and only when they are used all across the board (which ensures a lot of test coverage).
Moving the kernel to modern C