Thoughts after reading the thread: "How to elegantly get the enum code"

D

DaveB

Alf P. Steinbach wrote in thread "Are unsigned integers necessary?":
Anyway, that said, for a quick summary & explanation of C++
signed/unsigned issues, with some concrete program examples, see my
~last post in the aforementioned "How to elegantly get the enum code
from its string type" thread; in a threaded view it's nearly the last
article article in that thread.

I like your summary. I think it generated some, not all, of my thoughts
that follow.

I remember a similar thread from 3 to 5 years ago. Some "Le Champagne"
guy was arguing for doing what seems natural: use unsigned when negative
numbers don't make sense for the usage in the context of the application.
Having had always done that, I questioned back then if I was doing
something wrong by adhering to that principle also since other were
saying that was "wrong". After reading all of the thread you directed to
above, I have reached the same conclusion as I did back in time: go on
doing what I have always done. No offense to all of you who like to use
signed ints as much as possible or if you were trying to convince someone
that your way is "better".

Some people take it way too far though and categorize the whole issue as
"a newbie problem" when in reality it's a language problem. You may
choose to view C++ as the only reality for the forseeable future and
thereby "build your world around it". That's fine. I, OTOH, look forward
to the day when my code moves to a language more or less devoid of such
weak foundation and then all the litter in the code can be thrown out and
look nice. Until then, it will just have to be a bit messy and deal with
the idiosynchracies of C++. If C++ has to be "beaten into submission" to
get it to work, so be it. If using it means source code is ugly, so be
it. If it's a pig, it's a pig. Why put lipstick on it. Not that using
signed, IMO, is prettying anything up though!

Was the thread comprehensive enough for me? No, I'll have to actually
implement it to and then reassess what Java, Ada and C++ are doing, but
my short answer on that now seems to be that C++ and Java both got it
wrong, though I know C++ inherited most of it's problems, and I'm not
sure what Ada has implemented so Ada is what I need to research next. So
while the thread touches on some ancillary issues, it doesn't identify
the problem(s) or give solutions to it(them), though at least I have a
few things to tackle that were IMPLIED in the thread, if not danced
around.

Overall, I think threads like that show what a hodgepodge assemblage of
parts C++ really is. Sure, you can keep that old car going forever. Do
you want to though and is it prudent, are the questions to ask. I guess
if you're making the big bucks based on all that complexity, the answer
is a no-brainer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top