From: Martin Krischik <krischik@users.sourceforge.net>
Subject: Re: access & address
Date: Fri, 15 Oct 2004 10:30:46 +0200
Date: 2004-10-15T10:30:46+02:00 [thread overview]
Message-ID: <1957126.ShjE8HKL3e@linux1.krischik.com> (raw)
In-Reply-To: ckmkhq$i0k1@cui1.lmms.lmco.com
Xenos wrote:
>
> "Marc A. Criley" <mcNOSPAM@mckae.com> wrote in message
> news:2t7jm8F1sp752U1@uni-berlin.de...
>> "Xenos" <dont.spam.me@spamhate.com> wrote:
>> >
>> > "Martin Krischik" <krischik@users.sourceforge.net> wrote in message
>> > news:1347924.5V7QhTSfdI@linux1.krischik.com...
>> > > Unlike C/C++ where you can't switch type safety on even when you
>> > desperately
>> > > need it.
>> > >
>> > You obviously know nothing about C++ then.
>>
>> Don't tell me I can write a class to make this check, no one writes
> classes
>> to keep track of item counts. And if I create a CApples class and a
>> COranges class that includes quantities and prevents me from mixing
>> Apples and Oranges, why is it that _I_ then have to code up the range
>> checking, when every Ada programmer would write:
>>
>> type Apple_Count is range 0 .. 500;
>> type Orange_Count is range 0 .. 120_000;
>>
>> and let the compiler do both type safety and range checking.
>>
> Your point was not that you disliked the way you "switched on" type safety
> in C++.
Not not about dislike. The problem is that we all have to work with 3rd
party libraries - and non of the other do it. Only features which are used
by the mayoritiy of the developers of a give language are true features.
The rest is just academic talk.
> Nothing prevents you from mixing Apples and Oranges, you just have to tell
> C++ how you want this accomplished. Plus, you can tell the compiler
> whether
> to allow an implicit conversion or not with the explicit keyword.
When "explicit" was invented the C++ designers missed to one off change for:
typedef explicit int Apple_Count;
typedef explicit int Orange_Count;
Then perhaps the STL would have used "typedef explicit" - and them most of
the C++ developers as well. And then we would have type safety. As it is is
I have seen things like the following more then once:
std:string X = ...;
int X_Len = X.length ();
(std::string::lenght () returns size_t and not int)
With Regards
Martin
--
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com
prev parent reply other threads:[~2004-10-15 8:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-14 9:05 access & address Hans Van den Eynden
[not found] ` <1347924.5V7QhTSfdI@linux1.krischik.com>
[not found] ` <ckm14i$erb2@cui1.lmms.lmco.com>
2004-10-14 18:09 ` Martin Krischik
2004-10-14 20:13 ` CBFalconer
2004-10-15 8:18 ` Martin Krischik
[not found] ` <2t7jm8F1sp752U1@uni-berlin.de>
2004-10-14 18:17 ` Martin Krischik
2004-10-14 19:52 ` Xenos
2004-10-15 8:53 ` Martin Krischik
2004-10-15 17:30 ` Xenos
2004-10-16 14:25 ` Martin Krischik
2004-10-16 15:15 ` Rich Herrick
2004-10-15 15:46 ` Björn Persson
2004-10-15 17:09 ` Xenos
2004-10-17 23:38 ` Björn Persson
2004-10-18 7:42 ` Martin Krischik
2004-10-14 19:37 ` Xenos
2004-10-15 8:30 ` Martin Krischik [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox