[plug] pppd defaultroute problems

Peter Wright pete at cygnus.uwa.edu.au
Mon Jan 17 13:25:40 WST 2000

On Mon, Jan 17, 2000 at 04:29:06AM +0000, Christian wrote:
> Bret Busby wrote:
> > > char* badJoke = &mike;
> > Are you sying that Mike's address is a pointer to a bad joke? I
> > don't know what Mike thinks about that reference to his address...
> No, but the "code" (uh-hmm) could be misunderstood to mean that I
> think Mike is a bad joke so, to avoid casting such aspersions,
> perhaps:

What do you mean? Casting nastertiums is fun!

> char* badJoke = &mike_mail;


> would be better.  Alternately properly commented code would also have
> prevented the misunderstanding.  Also, since it was only the second half
> (roughly) of Mike's mail that contained the bad joke, perhaps:
> char* badJoke = (char*) &mike_mail + (sizeof(mike_mail)/2);
> is even better.  But then again, I think this has gone far enough. ;-)

Oh dear me, nooo..... :)

There is a bit of a problem in that we don't know where the badJoke
pointer ends, if it's regarded as an ordinary null-terminated string.
We could get all sorts of extra bonus stuff tacked on the end of the
end of Mike's mail, which might well spoil the joke, or even remove it
entirely from the "joke" type.

In order to get away from these low-level and error-prone
manipulations, I think we should rewrite Mail and Joke as C++ classes.

Then we can have:

Mail mike_mail;
// ...
Joke *badJoke = new Joke(mike_mail.portion(0.5, 1.0));

where the portion(float, float) method returns a portion of the Joke
as a C++ string, and there is a Joke constructor of the form

Joke(string s);

Of course, portion(x, y) expects x, y to be in [0, 1], and x < y - so
it would need to throw an exception if these conditions are not met.

Hmm, I could spend all day designing this. Where's a copy of Rational
Rose when you need it?

> Regards,
> Christian.


hundred-and-one symptoms of being an internet addict:
227. You sleep next to your monitor.  Or on top of it.

hundred-and-one symptoms of being an internet addict:
228. You spend Saturday night making the counter on your home page
     pass that 2000 mark.

More information about the plug mailing list