[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 6502 illegal opcodes questions



In article <nospam-7B7751.02054028052006@network-065-024-007-028.columbus.rr.com>,

> 222222In article <e598gn$134q$1@merope.saaf.se>,
>  pausch@saaf.se (Paul Schlyter) wrote:
> 
>> In article 
>> <nospam-467DFC.23375126052006@network-065-024-007-027.columbus.rr.com>,
>> 
>>> In article <e56rj1$7lo$1@merope.saaf.se>,
>>>  pausch@saaf.se (Paul Schlyter) wrote:
>>> 
>>>> In article <1148544621.115246.248890@y43g2000cwc.googlegroups.com>,
>>>> mdj <mdj.mdj@gmail.com> wrote:
>>> [...]
>>>>> The key concepts that are missing here are pointers, and more 
>>>>> specifically,
>>>>> the ability to perform arbitrary arithmetic on pointer types.
>>>> 
>>>> FORTRAN, Pascal and Ada lacks this too.
>>> [...]
>>> 
>>> This is certainly false for Ada:
>>> 
>>> http://www.adapower.com/rm95.php
>>> 
>>> In particular, the standard package Interfaces.C.Pointers overloads the 
>>> "+" and "-" operators for just this purpose.
>>> 
>>> http://www.adapower.com/rm95/RM-B-3-2.html
>> 
>> OK, Ada has pointer arithmetic - but is it arbitrary?
> 
> Well, it's arbitrary up to the limit of erroneous:  you can't access
> memory that's forbidden by the OS:-)

Ouch .... so much for the "security" of Ada......

>> Doesn't Ada impose strict range checking for all its data structures, 
>> throwing exceptions as soon as an attempt of out-of-range access is 
>> performed?
> 
> Certainly, constraint, overflow and elaboration checks can be turned on 
> and off selectively as requirements dictate.
> 
>> I though the fundamental idea behind Ada was to provide 
>> provably secure software, and then one cannot take pointer arithmetic 
>> as lightly as C and C++ both do.
> 
> Indeed, the capability is provided more to interface with existing code 
> than to represent exemplary style. In the normal course of programming, 
> one uses the operations and attributes of the referenced type (e.g. 
> array and records) rather than pointer arithmetic. In fact, Ada does 
> away with the syntactic distinction between the pointer and the thing 
> pointed to (e.g. p and p^, in Pascal). Java takes this even further, 
> allowing no access whatever to the underlying object reference as a 
> pointer.

ANSI C did that too, partially, by doing away with the difference between
functions and function pointers.  That's why this C program works:

#include <stdio.h>

int main()
{
    (***************************printf)("Hello, world\n");
    return 0;
}

 
>>> It is arguably false for many widely used flavors of Pascal including 
>>> Object Pascal and Turbo Pascal.
>>> 
>>> Even Fortran has a non-standard extension for this:
>>> 
>>> http://gcc.gnu.org/onlinedocs/gfortran/Cray-pointers.html
>> 
>> If we are going to include non-standard extensions of languages too,
>> then the Java camp should also include both J++ and C# .....
> 
> Touche! :-)

-- 
----------------------------------------------------------------
Paul Schlyter,  Grev Turegatan 40,  SE-114 38 Stockholm,  SWEDEN
e-mail:  pausch at stockholm dot bostream dot se
WWW:     http://stjarnhimlen.se/