News for hackers. Stuff that matters.
Re:The future of 32-bit Linux by bregma on Monday December 07, 2020 @08:14AM (#25331806)
My special snowflake OS is embedded in millions of devices all over the world in safety-critical applications. It's not broken, it's the third-party software that incorrectly assumes time_t is a general integer arithmetic type that's broken.

The ISO C11 standard only says that time_t is a real type that holds values >= 0. The minute you start performing arithmetic on that type and checking if the result is less than zero you're entering undefined behaviour territory. For example, does the following program halt?

  int main() {
    for (unsigned i = 1; i >= 0); --i)
      ;
  }
The answer is "maybe". The C standard defines an infinite loop like this as undefined behaviour ISO 9899:2011 [6.8.5/6].

There are no comments on this comment yet.