comp.lang.ada
 help / color / mirror / Atom feed
From: Olivier Henley <olivier.henley@gmail.com>
Subject: Re: C++ diaries...
Date: Fri, 7 Jun 2019 10:55:12 -0700 (PDT)
Date: 2019-06-07T10:55:12-07:00	[thread overview]
Message-ID: <bc15333c-03b2-485c-be81-2c444abace1c@googlegroups.com> (raw)
In-Reply-To: <60027108-2b92-417e-8083-eef19cc1e64a@googlegroups.com>

> You would be much more productive if you used non-clashing constant names.

There is nothing clashing here:

Whatever::SocketType::Raw 
Whatever::ProtocolType::Raw

Do the word 'Socket' and 'Protocol' looks like the same to you?

Ada gets it right and C++ is not 'looking straight' trying to sell me its an 'overloading' issue. 'Paths' or the 'chain' of 'named' 'spaces' are unequivocally different; easy breezy.

> You would be much more productive if you used non-clashing constant names.

I will not create something like Socket_Raw and Protocol_Raw to satisfy the original non sense ... oh damn I forgot its standard practice to do so in C++. I think I will take the time to change all enums to comply to that convention for the whole project. Good idea.

> And you might be more likely to stay in line with those coding standards that actually forbid enumeration overloading.

The original stuff is company wide and is not my creation in the first place.

> Which brings another question: what is the problem, actually? The fact that old enums don't support overloading, the fact that transitioning to new language features requires changes in old code or the fact that there are two kinds of enums in the first place? 

I already said so, all of the above. The thing, 'straight enums', should have worked properly day one. The concept of enum in C++ is arguably deceitful, wrong, broken, you name it. 

By the way, lets talk about C++ enums a tidy bit further. Can you get a string representation of your enums in C++ ... today 2019? 

This is a great Q&A:  

https://stackoverflow.com/questions/28828957/enum-to-string-in-modern-c11-c14-c17-and-future-c20 (Anyone, take the time to read it, its stand up comedy. Maybe there is an unknown disease that render people judgement-less...) 

>I agree that this third fact is somewhat cumbersome, but since there is no obligation to use the new one, it should not be a show stopper.

You know MenuetOS? They wrote a full fledge OS, graphics included, in ... FASM. So yeah, nothing is a show stopper... it's not a reason to deny a dubious endeavor when you cross one.

Olivier




  reply	other threads:[~2019-06-07 17:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-06 16:32 C++ diaries Olivier Henley
2019-06-06 16:54 ` Olivier Henley
2019-06-07  7:32   ` Maciej Sobczak
2019-06-07 17:55     ` Olivier Henley [this message]
2019-06-07 18:22       ` Keith Thompson
2019-06-07 23:04         ` Olivier Henley
2019-06-07 23:09         ` Keith Thompson
2019-06-07 18:29       ` Lucretia
2019-06-07 23:27         ` Olivier Henley
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox