Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yes, there’s always the “sufficiently smart compiler” that can generate this code. Question is, does that compiler exist?


I sure hope so. The semantics are trivially identical, the optimizations should be as well, by default - they should depend on semantics, not syntax. And GCC in another comment under this thread seems to be doing similar or identical optimizations in both cases.

I wholly admit that this implies nothing about all optimizers. But it's a pretty reasonable one to expect.


>does that compiler exist?

and if so are the compile times worth it


These days, I's put my money on zig cc. I.E. zig cc -Os or zig cc -O3


Does the zig compiler have many fancy bits? I was under the impression the c support was a "nothing special" compiler that punted to llvm for optimizations.


Correct, zig currently does not do any of its own optimizations. It won't necessarily have identical results to clang because it'll generate equivalent but not identical IR and the optimizer passes may happen to do something different as a result, but it's not going to be consistently different.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: