Robert Bauck Hamar wrote:
Paulo da Silva wrote:
[snip]
>The example is clear.
I need to use the stat structure without knowing its members types, i.e.
I am not sure if they are standard or system dependent.
They are and are not standard.
They are not standard in that the C++ and C standards does not describe or
reference any struct stat.
They are standard in that POSIX describes them, and POSIX is a standard.
The type of st_gid is defined in <sys/types.h>, which is not a standard
C++ header, to gid_t, and is guaranteed to be an arithmetic type.
>typeof fits exactly my purposes.
The problem is that it is non-standard, so, like stat, it is off-topic in
this group.
Actually, the question whether C++ allows for typing of return values and
variables based upon the type of given expressions, and if so, how one does
this in C++, is topical. It just so happens that the answer is: it's not
(yet) possible. That the answer is short and not helpful does not render
the question off-topic.
Also, extensions of the standard, currently under discussion, are topical
according to the FAQ anyway. Since there are considerations about "auto"
and the likes of it, the problem of the OP seems to be perfectly topical.
That does not change the fact, that as of now, he will have to resort to
compiler specific solutions.
Best
Kai-Uwe Bux