🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by T.Day Thu, 07 Dec 1989 11:52
Re: bastard programs
#235
Author: T.Day
Date: Thu, 07 Dec 1989 11:52
23 lines
1543 bytes
From: Tim Day <T.Day@uk.ac.ucl.cs>

Something to watch out for:
It's quite possible to write e.g stdout << "foobar" and similar things by
accident.  The type conversion attempts to convert stdout to an ostream 
(possible using the ostream constructors); there is be no warning message, 
but the program usually bombs in all sorts of strange places if you write
 stdout << "a" << "b"
as the newly constructed ostream goes out of scope before the second
operator<< is called; (except that it hangs around on the stack long
enough to look like it had worked and/or screws up the stack to mislead
the debugger).

I suspect mixing cerr and stderr is asking for trouble.  Either use one or
the other, or perhaps derive your own ostream class and replace all the
operator<< routines with stuff to access FILE*s (or cerr specifically)
safely using fprintf.

+-----------------------------------------------------------------------------+
Tim Day                           | Meet every second in life as challenge;
Department of Photogrammetry      | Respond fully to whatever happens
UCL, Gower St., London  WC1E 6BT  |  without anxiety, or complaint, or clinging
+-----------------------------------------------------------------------------+
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads