[mercury-users] rotd-2007-02-10 won't compile on Ubuntu

Julien Fischer juliensf at csse.unimelb.edu.au
Tue Feb 20 18:43:47 AEDT 2007


On Thu, 15 Feb 2007, Michael Day wrote:

> Hi Julien,
>
>> I'm open to suggestions on how to handle this one more gracefully.
>
> You could just not call fatal error, as in the case where fdopen() is not 
> available:
>
> #else
>    /*
>    ** XXX Standard ANSI/ISO C provides no way to set stdin/stdout
>    ** to binary mode.  I guess we just have to punt...
>    */
>    MR_file(mercury_stdin_binary) = stdin;
>    MR_file(mercury_stdout_binary) = stdout;
> #endif
>
> I guess a more elegant approach would be to delay calling fdopen() until the 
> program actually tries to access the binary input/output streams,

That would mean we would need to add a test every time we tried to access
one of the binary input/output streams.  If nothing else it's a bit
of maintenance problem because we have to remember to do it everywhere
we access those streams.

> but just not aborting would already be an improvement.

Unless there are any objections I intend to change the code to
MR_file(mercury_{stdin,stdout}_binary) = {stdin,stdout} if the call to fdopen
fails.

Julien.
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the users mailing list