[fpc-pascal] IE 200307043
Prince Riley
wmarketing3 at gmail.com
Mon May 25 23:09:44 CEST 2009
Jonas
Thank you Jonas, for clearing that up. I agree.
You have more courage than I my friend to say that, for down that path lies
monsters. For while I must agree with your point, in theory it raises a
bigger concern.
The 'nil' for a pointer constant is problematic in two ways. Fixing this
'bug' could mean addressing two language issues. Type checking for valid
pointer arithmetic and the difference between a 'null' or empty pointer and
one that has the lowest value of it's type.
Both those points may sound abstract and esoteric, but they lie at the heart
of the 'fix' for this bug. As you can surmise, for a strongly typed language
like Object Pascal, pointer operations should be 'type safe' at best and
'type neutral' for flexibility and utility.
Even the apparently simple addition of numeric literal and a pointer
requires considerable thought for reasons of portability and ensuring that
pointer arithmetic doesn't become a source of opaque bugs.
Prince
On Mon, May 25, 2009 at 8:43 PM, Jonas Maebe <jonas.maebe at elis.ugent.be>wrote:
>
> On 25 May 2009, at 22:39, Prince Riley wrote:
>
> That's a very interesting answer. So am I understanding you to say that
>> the
>> expression of the form
>>
>> var := constant + numeric literal ;
>>
>> is an invalid expression (syntax) in Object Pascal?
>>
>
> No, I meant that there was a bug (error) in the compiler regarding handling
> expressions of the form "nil + <integer constant>". It's a valid expression.
> nil has as type "pointer", and you can add integers to untyped pointers
> (constant or not). The result is again an untyped pointer.
>
>
>
> Jonas
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20090525/ad01886a/attachment.html>
More information about the fpc-pascal
mailing list