Pointer Constants

When you declare a pointer constant, you must initialize it to a value that can be resolvedat least as a relative addressat compile time. There are three ways to do this: with the @ operator, with nil, and (if the constant is of type PChar or PWideChar) with a string literal. For example, if I is a global variable of type Integer, you can declare a constant like const PI: AInteger = @I;

The compiler can resolve this because global variables are part of the code segment. So are functions and global constants:

const PF: Pointer = @MyFunction;

Because string literals are allocated as global constants, you can initialize a PChar constant with a string literal:

const WarningStr: PChar = 'Warning!';

Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook


Post a comment