[fpc-pascal]Classes/Objects/Pointers / Pointer Help

Anton Tichawa anton.tichawa at chello.at
Mon Feb 10 13:24:05 CET 2003


Hello!

If TNick is a class - I don't have the declarations - it must be initialized 
with

  nicks := new(TNick, init(nick, hops, signon, ident, host, server, unused,   
  name));

That's correct because TNick is already a pointer, not an object, and init is 
required to call TNick's constructor.

But the problem ist a more generic one .. I'll try to formulate the 
questions: A procedure (Alice) passes Data to another procedure (Bob):

***
procedure Alice;
begin
  Bob(Data);
end;
***

Questions:

1. is Data "empty", i. e. is the call to Bob parameterless? Note that even in 
this case, there is still information flow between them, because 1. Bob knows 
having been called by Alice (which is information > 0 bit), and 2. might read 
input and return results in a predefined, global manner.

2. is Data readable?

3. is it writeable?

4. is it a special (CPU, hardwre) register, or global memory?

5. Is Data the only one of it's kind, or does it need addressing? If it needs 
addressing, is the address defined? Does Data have a fixed size? If not, is 
the size known or unknown?

6. Other questions that I don't see at the moment. One of these is the SWITCH 
mentioned below.

7. Is Data a pointer? If this is the case, then pointer types should be able 
to point to "null", "readable", "writeable", "register / memory", and other.

I think the solution isa kindof redundancy. As a legacy example, look at 
pointers: Pointers with value $00000000 are defined as "nil". That disallows 
pointing to a variable at address 0. On one hand, that excludes memory at 
address 0 to be used for "pointed-to" data. On the other hand, low-level 
access with references to address 0 might still be required in some cases, 
simply to increase performance.

There should be some kind of aggreement about Data. As a second example, 
Classes e. g. are now checked (the VMT contains a kind of checksum), but this 
is dangerous for every-day run-time type information, because a pice of 
arbitrary data might contain a correct checksum, thus pretending to be a 
class .. trak! exception.

I suggest the words "SAFE" and "FAST" for these two "modes of operation".

SAFE mode obeys legacy agreements, forces redundancy, and Bob is guaranteed 
to find a solution for the questions mentioned above, converning Data. In 
case of misunderstandings, exception handling moves the system to the safe 
side.

In FAST mode, there is no redundancy, i. e. hardware runs at full speed, but 
software might crash.

I suggest a BIG RED SWITCH on top / front of the computer, which is normally 
switched OFF, forcing SAFE mode, disallowing references to address 0 with a 
pointer, requiring action to follow previous negotiations.

Any ideas how to continue this topic?

Anton Tichawa.



----------

"Adas Methode war, wie sich zeigen wird, Tagträume in offenbar korrekte 
Berechnungen einzuweben."

Doris Langley Moore: Ada, Countess of Lovelace (London 1977).

----------

Anton Tichawa
Volkertstrasse 19 / 20
A-1020 Wien
mobil: +43 664 52 07 907
email: anton.tichawa at chello.at

----------



More information about the fpc-pascal mailing list