cin/cout as reference objects [Re: AIX I/O failures]

Gabriel Dos Reis
Thu Jan 25 22:53:00 GMT 2001

Mark Mitchell <> writes:

| >>>>> "Richard" == Richard Henderson <> writes:
|     Richard> You should therefore be *extremely* cautious in exporting
|     Richard> anything from a shared library that isn't a function or a
|     Richard> built-in type such as a pointer.
| Thanks for the detailed analysis.  That's very interesting.
| What you say, though, applies to the *original* approach as well, so
| we're no better off than we were then, if I understand correctly.
| (Because all I did was change the *type* of an aggregate, not its
| existence.)
| So, you're information argues in favor of Gaby's proposal -- the
| indirection protects you against changes in the sizes of the object,
| from the ABI point of view.
| But, that doesn't really do any good, because there are inline
| functions on ostreams anyhow, and because users can say `sizeof
| (cout)' in their programs, and if the library implementors change the

If they say sizeof(cout), they will get sizeof(ostream).  Why is that
incorrect ?

-- Gaby
CodeSourcery, LLC             

More information about the Libstdc++ mailing list