Hi,
"But why do we have to be so pedantic here? If our ftell() returns
off64_t, it is still source code compatible with 99 % of code which uses 
it thanks to the implicit conversion from off64_t to long. Yes, there
might be corner cases like using ftell() as a function pointer or
possibly different behaviour when an expression targeting a 32bit
platform does not overflow as expected, but those can be either easily
solved or are questionable in the first place (since it might be an
undefined behaviour)."
OK so clearly I had nothing to do with the ftell() change :-) Still I do 
think it's the right way to go.


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

"
""

Imagine you could go back in time and affect the proposal of the ISO C
with your current knowledge. Would you really keep the return type of
ftell() as long? "
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.





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.




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!)





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.





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

Reply via email to