Hello Ovanes,
This over-allocation is pretty much the same as reserving some space at the
end of the data structure to place data together. Am I right? Why isn't it
possible to just write char[128] or char[16] instead of char[1]?
I can't change that code because it lives in a system header.
And if
you know that this buffer represents some special case, why don't you pass
it as such to filesystem? &char[0], than boost::filesystem will not assume
it got char[1] and will be looking to '\0' marker...
How would I know that this buffer represents some special case?
FTS(3) library documentation says something like that:
struct _ftsent
{
...
char *fts_name;
};
But the structure is really defined another way (Linux, Mac OS X):
struct _ftsent
{
...
char fts_name[1];
};
I believe this discrepancy is pretty much negligible anyway.
There are huge number of programs utilizing fts(3) APIs and they don't break.
Unfortunately boost::filesystem is another story.
It does break and it does break silently.