C runs on more platforms than I'm familiar with? Is there more than windows
then? The point I'm trying to make that a function like filesize could be
put into the standard easily regardless if there are situations where this
function wont work well. The standard already has many functions that wont
work on many systems.
Leaving freestanding implementations aside for the moment which get to
"cheat" after a fashion as to what they have to support, share some of
them with us. Name 3 of these functions, and give examples of where
they don't work on a hosted implementation. If you mean
"implementation defined behavior by chance, that is != "wont [sic]
work".
Could be interesting to see a graph over time when the files grow or shrink
most. But yeah funny haha, who needs management and marketing information
anyways.
If a database developer felt that such information was quite important,
I suspect that he would implement an efficient low-level solution
particular to the supported platform(s), abstracted as need be for
multi-platform support in its internal implementation and provide that,
rather than rely on some generic "standard C library" implementation to
hopefully give him what he needs, even if it existed. Performance
tuning being as critical as it is in db work, where things like
bypassing the typical file systems completely on the platform and
writing directly to the raw storage media directly instead is not
uncommon, I'd find it surprising for anyone other than a naive
implementer to not at least explore a more specific option, unless he
had performance measurements taken on all supported platforms that
demonstrated there was no need for it. Not to mention a standard
filesize() function to fall back on, of course
What DBMS is it that you work on?
None currently. Feel free to draw on your vast current experience to
point out my mistakes, I'd enjoy learning more about the subject.
Dont worry about my time I'm in "the usenet zone" at the moment. I would've
used fstat long ago if a situation called for getting a file's size and
where I expected this function to work.
If you would rely on the ability to call fstat(), then we can make some
assumptions about those platform that you don't care about. There is
no problem with that, as long as everybody that cares about the code
finds it a credible design decision.
I would've kept it secret to clc of course because now I have written
unportable code.
You can write portable code, while using non-standard functions, it
just takes more care, in some cases, a lot more, and you have to narrow
your definition of "portable" to "portable to those platforms that we
currently or expect to care about in the lifetime of the product".
That is a legitimate, real world design decision that is made all quite
often. Even more common is that the issues are not even considered,
and it is a problem for the "next guy" long after the current one has
left the building.
Deciding to purse this option of separating out the non-standard
support such that it can be ported to platform N+1 with a minimal
impact on the existing common core code is not wholly trivial, but it's
not extremely difficult either. Even so, it happens far less often
than you might hope.
This is not the same as writing pure standard C code alone, but that's
not really an issue if it is done cleanly, and the areas where porting
to an as yet unimplemented new platform would require attention are
documented appropriately.