English 中文(简体)
Untyped Pointer in Pascal
原标题:

What can I do with untyped pointers in Pascal? (Why untyped pointers are good?)

最佳回答

In Borland family Pascal s, you can pass a typed pointer to a parameter of the untyped pointer type. IOW

procedure test (x:pointer);

will also accept pchar etc. This is particularly useful for lowlevel routines like e.g. a routine that moves data ( move() or searches a memory range for a certain value etc, compress a certain memory range etc).

Some people also name pointer arithmetic as a reason, but e.g. Delphi allows that on pchar too.

FPC and Delphi 2009+ even allow it on other types.

问题回答

暂无回答




相关问题
C: Accessing a pointer from outside a function

I have the following code: int takeEven(int *nums, int numelements, int *newlist) { newlist = malloc(numelements * sizeof *newlist); int i, found = 0; for(i = 0; i < numelements; ++i, ...

Scheme, getting the pointer from pointed struct

Assume I have a such struct: (define-struct node (value next)) ;and making 2 nodes, parent pointing to child as next. (define child (make-node 2 null)) (define parent (make-node 1 child)) Under ...

DO s and Donts while using pointers

Its a simple but important question. What are the do s and donts while using a pointers in C and C++ so as to make sure SEGMENTATION FAULT is avoided on AIX? Where char * are preferred over character ...

确保点名不删除

我 st卑地 something了我可以说出的东西,因此,我认为,在更大的C++图像中,我没有东西。

C#: Using pointer types as fields?

In C#, it s possible to declare a struct (or class) that has a pointer type member, like this: unsafe struct Node { public Node* NextNode; } Is it ever safe (err.. ignore for a moment that ironic ...

Data Destruction In C++

So, for class I m (constantly re-inventing the wheel) writing a bunch of standard data structures, like Linked Lists and Maps. I ve got everything working fine, sort of. Insertion and removal of ...

Question regarding de-referencing structure pointers

I am compiling this piece of code and I get compilation errors saying " dereferencing pointer to incomplete type" . I get the errors for the last print statement and before that where I try to point (...

热门标签