This is a secondary account. My main account is listed below. The main will have a list of all the accounts that I use.

henfredemars@lemmy.world

  • 0 Posts
  • 15 Comments
Joined 2 years ago
cake
Cake day: July 11th, 2023

help-circle

  • Why do people buy organic fruits and vegetables?

    I care about where the code comes from. I like the community to come together on a good solution rather than have one spat out of unknown quality. I want to both test and have that community working together towards a common goal. Fundamentally, I think that sharing our answers and cataloguing them as developers is a good strategy. Way better than AI.

    If AI is ultimately borrowing its answers from open source, wouldn’t it be better to just go use open source? At least then there’s some hope that if people find issues and edge cases that I might get those fixes in the future. Why limit your upside to zero? Like, I can put my entire program in one source file maintained by just me but it doesn’t mean I should. Is this an argument against why libraries are a good idea?













  • There’s also this part of the standard that throws a wrench into this hypothesis:

    §5.1.2.3/4: (Program execution, Observable behavior):

    Accesses to volatile objects and calls to library I/O functions are observable behavior. The implementation may perform any transformation of a program, provided that the resulting program’s observable behavior is not changed.

    So it seems that running forever isn’t an observable property that must be preserved when code is transformed.

    Still, I think compilers try to not surprise the developer too badly and would recognize a trivial loop most of the time.



  • The compiler (in C) is allowed to assume that infinite loops eventually terminate. This can lead to these kinds of loops not actually running forever when built with an optimizing compiler.

    ISO/IEC 9899:2017 §6.8.5 “Iteration statements”, paragraph 6:

    “An iteration statement may be assumed by the implementation to terminate if its controlling expression is not a constant expression, and none of the following operations are performed in its body, controlling expression or (in the case of a for statement) its expression-3: – input/output operations – accessing a volatile object – synchronization or atomic operations."

    It can, for example, simply optimize it away, assuming non-productive infinite loops are stupid and not reflective of what the code will actually do.