[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Mar 30 15:18:37 2000 
Subject:Re: FWD: from Jonathan Cunningham about Macintosh implementations 
From:jlc 
Volume-ID:1000330.04 

(I've constructed the "To: " line by hand on this one)


>> In developing a C++ application, modern tools make this relatively
>> simple to do. (The strings aren't stored in a file, but in 
...


David Young (Hi David) said,
>...I remember going to a BCS talk in about 1980
(snip)
>couldn't quite see why the man was making such a big deal of it. It's
>easy in Fortran - does C++ buy you anything?


It was the "modern tools" I was referring to, not the language.

In C++ (or C), typically you would have done this by defining the
constant representing the error code; this definition would go in
one file, the usage in the source code, and the actual string
itself in a third place.

E.g. in a file called "errorcodes.h"
    #define E_LIST_NEEDED 32769
    #define E_NON_EMPTY_LIST_NEEDED 32770
Actual usage in the source code, maybe in a file called "foople.cpp"
    mishap((item==NIL ? E_NON_EMPTY_LIST_NEEDED : E_LIST_NEEDED),
            1, item);
and the actual strings themselves need to be entered into the string
table.

Being able to do those three edits with little more than a couple
of mouse-clicks counts, I think, as a yes to "buy you anything?"
(Frex, you never need even to look at the errorcodes.h file,
since the next number in sequence is chosen, and the definition
is constructed and inserted, automagically.)

Of course you could (and I would) define a ved macro to do something
equivalent in poplog; although I wouldn't use integer constants as
the error codes.

The other point to clarify is that the strings are not stored in
a separate file, but as a "resource" which, after linking, forms
part of the executable. This would be on PCs (or Macs). I don't
know about the format of executables on unix nowadays, so I don't
know what the conventions are for embedding data.

There isn't an obvious equivalent for this
in pop11: I suppose it's roughly like making a saved image in
which all the (language specific) error messages have already been
read from the library. It hardly seems necessary.

Jonathan

p.s. Incidentally, anyone comparing this with Aaron's original
message will notice that I reversed the order of arguments
to mishap. This is not an error.