Topic: signed/unsigned/long/short keywords are bad
Author: "Sean L. Palmer" <seanpalmer@mindspring.com>
Date: 1997/03/16 Raw View
I think it's a bad idea to have the builtin type names have forms which
aren't duplicatable using user-defined types. Signed and unsigned aren't
applicable to user-defined types. To do so would be an error. So there is
no way I could ever define a class like this:
class signed fixedint {
};
class unsigned fixedint {
};
same with long/short modifiers.
IMHO it would be far preferrable to have single identifiers for the builtin
type names (actually I'm miffed that they are keywords, since that
prohibits the definition of member functions with those names, even though
there would be no ambiguity). Mainly so that builtin types don't have much
that user-defined types can't have.
There are other problems. For instance, I can't 'hide' or replace unsigned
int with something else using the preprocessor.
I suggest that some new type identifiers be introduced that should
eventually replace the multi-word versions. Such as char, short, int, long,
ushort, uint, ulong, uchar, float, double, ldouble
Not that I expect anyone to take this seriously. This is for a language
spec which can't make up its mind whether char should be signed or not.
Even though it requires there to actually be a signed and unsigned char.
There's no ambiguity with int--it's signed, yet char doesn't follow this
system... strange..
I also know that posting to this newsgroup has absolutely no effect on the
standard. Such is life.
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Author: thegoat4@airmail.net (Bryant Brandon)
Date: 1997/03/17 Raw View
In article <01bc31c2$90d62120$a30b1d26@ghost.artnet.net>, "Sean L. Palmer"
<spalmer@pobox.com> wrote:
[...]
>
>Not that I expect anyone to take this seriously. This is for a language
>spec which can't make up its mind whether char should be signed or not.
>Even though it requires there to actually be a signed and unsigned char.
>There's no ambiguity with int--it's signed, yet char doesn't follow this
>system... strange..
>
>I also know that posting to this newsgroup has absolutely no effect on the
>standard. Such is life.
I'm of the opinion that char and string literals should be unsigned by
default. Most of the time char is used to manipulate character data, not
itty bitty numbers. Besides, as far as I know, there are no negative
ASCII codes.
If you'd like to use a char as a number, declare it signed. Simple
right? Not simple enough for a commitee. (:
B.B.
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]