News for hackers. Stuff that matters.
Re:The joy of max() by rwmj on Saturday March 31, 2018 @02:21AM (#16722032)
The lesson here is that if you're designing an operating system, you should also be designing/evolving the programming language to go alongside it. The original authors of Unix did this (developing C in parallel), and so have many more obscure OSes. This could have been written simply as 'max()' with appropriate modifications to the compiler to make it do the right thing.
Re:The joy of max() by brianon99 on Saturday March 31, 2018 @05:16AM (#16722499)
Things have changed over the years. Even if the developers have patched gcc, or "own" gcc, linux still have to be built with gcc 4.4 otherwise many distro will have problems, so it does not solve the problem.

Moreover, change the semantics of C as you have suggested will break other non-linux-kernele existing programs. There may exists programs depending on the K&R version of max with side effect. Who nows?

Re:The joy of max() by mjw1007 on Saturday March 31, 2018 @05:48AM (#16722595)
I think asking the GCC developers for a builtin form of __is_constant would be a sensible step, so that the worst of those macros can eventually be retired.
Re:The joy of max() by psyc on Saturday March 31, 2018 @01:49PM (#16724291)
I'm 100% on board with this. I think big low-level projects, including AAA games (my field) would benefit by treating the compiler exactly like a dependency they have the source for. We might stumble on very good language evolutions as a side effect.
Re:The joy of max() by kzrdude on Saturday March 31, 2018 @04:23PM (#16725002)
Don't we risk losing something if everyone is using their own dialect of the language?
Re:The joy of max() by psyc on Saturday March 31, 2018 @04:36PM (#16725049)
I don't think so. But you're safe, nobody will do this.
Re:The joy of max() by paulddraper on Sunday April 01, 2018 @04:08PM (#16730161)
Yes.

IDE support, debugging, instrumentation, profiling, portability, community libraries.