[fpc-pascal] Is it possible to redefine FreePascal types?

Kenneth Cochran kenneth.cochran at gmail.com
Wed Nov 21 20:49:02 CET 2012


type newString = type string;

Any function that accepts newString as a parameter will cause a compilation
error if you try to pass a normal string. You'll have to cast it to
newString first.

On Wed, Nov 21, 2012 at 1:37 PM, Frank Church <vfclists at gmail.com> wrote:

> Lets say I am using some string variables, but I want to ensure that there
> are no typing errors in some code I am using.
> so I define newString as a new string type and declare a variable as
> ANewString.
> That way if I create a function such as functionUsingNewString(a:
> newString) and I pass a plain string as a parameter to functionNewString
> the compiler declares an error.
> If c is string and b is newString and I do b := c the compiler should
> generate an error unless I do b := newString(c);
> Is this possible?
> --
> Frank Church
> =======================
> http://devblog.brahmancreations.com
> _______________________________________________
> 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/20121121/82b20d65/attachment.html>

More information about the fpc-pascal mailing list