From: xavier grave on 16 Apr 2010 06:34 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Maciej Sobczak a �crit : > On 15 Kwi, 10:59, "J-P. Rosen" <ro...(a)adalog.fr> wrote: > >> "C++ is a strongly typed language, if conversions between logically >> unrelated types are avoided". >> >> Ain't that cute? > > http://en.wikipedia.org/wiki/Strong_typing May be I'm wrong, but I didn't find any reference of Ada in this page. I bet we can't count Ada as a Pascal family language in this case ? :) - -- xavier -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkvIPUEACgkQVIZi0A5BZF4GqACbBPUTJpzpFnaFmNtcl00j4jqv Gi8AoLs58B4TNahB7PbHBUSn3NdAIA1C =LKqi -----END PGP SIGNATURE-----
From: Maciej Sobczak on 16 Apr 2010 11:32 On 16 Kwi, 09:28, "J-P. Rosen" <ro...(a)adalog.fr> wrote: > Do not confuse "weakly type" and "strongly type with a mean to disable > it in a controlled way when absolutely necessary". Having no safety > belts in a car is not the same thing as having belts and not putting > them (as far as the car design is concerned). > > What I find amusing (or characteristic of the C/C++ spirit) is the idea > that "if you are careful, it is good enough". So which C++ language features exactly make it not strongly typed? I agree that the C++ programmer has to be careful, but here I'm interested in the strong type safety aspect. Which constructs violate the strong type safety in C++? (Of course, I expect that such or analogous constructs do not exist in Ada.) > I generally conclude my presentations of Ada with two quotes. The first > one is from K&R, in one of the first books about C: Let's focus on recent C++ standard instead of early versions of C. -- Maciej Sobczak * http://www.inspirel.com YAMI4 - Messaging Solution for Distributed Systems http://www.inspirel.com/yami4
From: Georg Bauhaus on 16 Apr 2010 12:52 Maciej Sobczak schrieb: >> I generally conclude my presentations of Ada with two quotes. The first >> one is from K&R, in one of the first books about C: > > Let's focus on recent C++ standard instead of early versions of C. The necessity to use C types is what the cited article defines as "weak", I think. There is a glossary. IIUC, a C(++) int and another C(++) int might be logically unrelated, yet they tend to be of the same type. A Current and a Count might be logically unrelated, and they tend to be of different types in Ada, though both are integer types. If backwards compatibility could be made an option instead of a drag, int<...> made a template, how much of the trouble might this remove, how well can it be integrated with the STL, ...
From: Dmitry A. Kazakov on 16 Apr 2010 13:24 On Fri, 16 Apr 2010 18:52:24 +0200, Georg Bauhaus wrote: > A Current and a Count might > be logically unrelated, and they tend to be of different types in Ada, > though both are integer types. BTW, the Ada's OO kernel has this same design flaw. You can clone all types, but tagged: type Count is new Current; -- This is OK only if Current is not tagged! -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
From: J-P. Rosen on 16 Apr 2010 16:20
Maciej Sobczak a �crit : > So which C++ language features exactly make it not strongly typed? > 1) Lack of user-defined elementary types 2) Type promotion -- --------------------------------------------------------- J-P. Rosen (rosen(a)adalog.fr) Visit Adalog's web site at http://www.adalog.fr |