Hi Jiri S.,

Note: https://docs.oracle.com/cd/E23824_01/html/821-1465/ftell-3c.html#scrolltoc

On Solaris, at least, it does not overflow, it returns EOVERFLOW

OK, so either this is the standard behaviour which we don't implement, thus we still deviate from the standard and implement a non-standard ftell(). Or Solaris is implementing a non-standard ftell().

Either way, how cool is that? :-D

No, but if you are going to make iit return off64_t, you are threading dangerous waters. It's not just that the function does not *fail* as expected. The problem is that the compiler of a checker might complain / throw an error with -Werror that you are implicitly converting off64_t to long and losing precision.

Which you can workaround by an explicit typecast to long that does not break anything if ftell() really returns long.

Conversely the *benefit* of ftell returning off64_t for a 3rd party portable software is nil. It has two choices: either it is fine with not being largefile aware and uses ftell() on all platforms, or it decides to be largefile aware and uses OS-specific method on all platforms.

Or it might use ftell(), but still store the return value in a 64bit integer for whatever reason.

But again, this discussion is mostly academic once we have our previous implementation under a different name back.

HelenOS native software would have the doubtful benefit of having a ftell fuction that "works" thus becoming alien to anyone who reads it - human or machine - that would set of red flags in both humans and tools - (they would think there is a bug here, it is not largefile aware!)

This is a double standard. There are hundreds of subtle ways our API deviates from the standardized behaviour (mostly in semantics). So why this particular case deserves such a pedantic treatment?

I thought we were clear that HelenOS is written in C, not in some weird language that just happens to be similar. That would never work.

In that case we disagree on the operational definition of C. For me, C is the core language (syntax, semantics of its intrinsic language constructs, run-time bindings required by the compiler).

The Standard C Library is an extension of the core C language that I consider mostly replaceable (naturally except the function calls that are emitted by the compiler itself).


M.D.

_______________________________________________
HelenOS-devel mailing list
[email protected]
http://lists.modry.cz/listinfo/helenos-devel

Reply via email to