AIX I/O failures
Thu Jan 25 12:46:00 GMT 2001
On Thu, Jan 25, 2001 at 09:20:58PM +0100, Gabriel Dos Reis wrote:
> David Edelsohn <firstname.lastname@example.org> writes:
> | >>>>> Gabriel Dos Reis writes:
> | Gabriel> Mark Mitchell <email@example.com> writes:
> | Gabriel> | char cin[sizeof(istream)]
> | Gabriel> | __attribute__ ((__align (__alignof__ (istream))));
> | Gabriel> Wouldn't then cin get type 'char'? Or am I missing something?
> | Yes. I believe that one needs to keep the cin type used in the
> | initializer completely separate from the rest of the code which defines
> | the correct istream type for cin.
> This is really ugly because, on one hand cin is seen with the right
> type and on the other hand as array at the code level -- I wouldn't
> to debug such a mess.
Indeed. Calling this "opaque" seems too kind. :-) We can't just handwave
around the issue of "need to keep the types separate" -- I believe declaring
cin as a char array *anywhere* is going to get us into trouble.
> Can a conforming program detect the followiing declaration for cin:
> extern istream& cin; // can a conforming program detect?
> so that we can do
> char __cin_storage[sizeof(istream)]
> __attribute__ ((__align (__alignof__ (istream))));
> istream& cin = *(istream*)(&__cin_storage);
> Or is that still sufering from the init issue?
I just tested this; it works on linux. I won't be able to test on solaris
unti later today or tomorrow. (I don't have an AIX box, of course.)
Changing the type of cin to a reference seems to be not too dangerous.
Got to love that as-if rule. :-)
pedwards at disaster dot jaj dot com | pme at sources dot redhat dot com
devphil at several other less interesting addresses in various dot domains
The gods do not protect fools. Fools are protected by more capable fools.
More information about the Libstdc++