Re: Feature Warning Request: Possible loss of data




"J French" <erewhon@xxxxxxxxxx> wrote in message
news:45752899.439080@xxxxxxxxxxxxxxxxxxx
On Mon, 04 Dec 2006 22:04:38 -0600, Rob Kennedy <me3@xxxxxxxxxxx>
wrote:

J French wrote:
On Mon, 4 Dec 2006 10:46:19 +0100, "Skybuck Flying" <spam@xxxxxxxxxxx>
wrote:

"J French" <erewhon@xxxxxxxxxx> wrote in message
news:4572f441.17584586@xxxxxxxxxxxxxxxxxxx
On Sun, 3 Dec 2006 16:11:30 +0100, "Skybuck Flying" <spam@xxxxxxxxxxx>
wrote:

<snip>

Delphi does not produce a compiler warning as far as I know.

It does produce a runtime error which is ofcourse totally useless.

Now I follow - the penny has finally dropped

You have an unusual example in the C code, the optimizer is knocking
out the intermediate step.

Do a few more things with the variables B and i at some stage it will
fail to pick up the 'error'.

The Visual C++ compiler will warn when you assign a value of a large
type to a variable of a smaller type. The actual values aren't
considered, just their sizes.

I follow - thanks for clearing that up.

J French was too stupid to figure this out for himself from the example.

That just shows J French has no experience with Visual Studio what so ever.

Absolutely worthless ! :P*

Every good/decent programmer should have programmed in all main general
purpose programming languages like:

java, c, c++, pascal, delphi, fortran, clipper, php, javascript just to
learn how other languages and compilers work.

Delphi does not offer to produce that sort of warning. It will, however,
let you consider such an assignment an error at run time if the actual
value being assigned is too big to fit in the space allotted. A thorough
testing regimen should make the difference minor, but whose tests are
really that thorough?

I suppose Delphi is assuming that programmers coercing into narrower
variables are canny enough to watch out for problems.

Lol, don't assume, Delphi is just lacking.


It's reasonable for Skybuck to want the compiler to warn in such
circumstances, but he is still too stubborn to realize that this
newsgroup is not the place to make feature requests.

Yes, I follow.
Funny because if he were less combatative he could have set of an
interesting discussion in the merits/demerits of coercion.

You would be pissed too if stupid *** like this caused bugs in your
programs.

And trust me these kinds of bugs can be very hard to track down because the
happen in extreme circumstances etc.

And I predict these kinds of bugs will be more common in the years to come
when programs will need to be updated for 64 bit.

It's definetly time for Delphi to be updated and include this great feature
as well... however I don't like use typecasts like in C to force this loss
of precision or something like that.

Special inlined routines could be used to get the first 32 bits of 64 bit
integer if so desired.

For example:

GetLowerInteger( Para : int64 );

GetHigherInteger( Para : int64 );

Using the round function would be overkill...

and a typecast is just weird.

Bye,
Skybuck.


.