Macros pascal define中的Pass参数

Macros pascal define中的Pass参数,macros,pascal,freepascal,preprocessor,Macros,Pascal,Freepascal,Preprocessor,我试图用pascal(freepascal)来定义一些东西。 与C++一样,你可以传递变量定义宏: #define REP(i,k) for(int i=0; i<k; i++) #为(int i=0;i定义REP(i,k)使用外部预处理器,并在生成系统中执行它,然后再对结果使用Pascal编译器 FPC宏系统不是用于元编程,而是用于在头文件中调用约定宏和紧凑的启用/禁用逻辑(如home brewn assert和其他调试日志代码),不支持参数化 非卫生宏基本上与Pascal单元系统不兼

我试图用pascal(freepascal)来定义一些东西。 与C++一样,你可以传递变量定义宏:
#define REP(i,k) for(int i=0; i<k; i++)

#为(int i=0;i定义REP(i,k)使用外部预处理器,并在生成系统中执行它,然后再对结果使用Pascal编译器

FPC宏系统不是用于元编程,而是用于在头文件中调用约定宏和紧凑的启用/禁用逻辑(如home brewn assert和其他调试日志代码),不支持参数化


非卫生宏基本上与Pascal单元系统不兼容,卫生宏包含在内联函数/过程中。

使用外部预处理器,并在生成系统中执行它,然后再对结果使用Pascal编译器

FPC宏系统不是用于元编程,而是用于在头文件中调用约定宏和紧凑的启用/禁用逻辑(如home brewn assert和其他调试日志代码),不支持参数化


非卫生宏基本上与Pascal单元系统不兼容,卫生宏包含在内联函数/过程中。

您可以使用宏和include的组合来实现类似于令牌粘贴的功能

ACME\u Integer.inc

const ACME_1 = ACME_3;
const ACME_2 = pred(1 shl ACME_1);
type  ACME_0 = 0..ACME_2;
//clear the passed in parameters so they can be reused in the next inclusion
{$undef ACME_0}{$undef ACME_1}{$undef ACME_2}{$undef ACME_3}           
     {$ifdef ACME_packed_array}
         {$undef ACME_array}
         {$define ACME_array:=ACME_packed_array}

         {$undef ACME_array_decl}
         {$define ACME_array_decl:=packed array}
     {$else}

          {$ifdef ACME_bitpacked_array}

             {$undef ACME_array}
             {$define ACME_array:=ACME_bitpacked_array}

             {$undef ACME_array_decl}
             {$define ACME_array_decl:=bitpacked array}

           {$else}
               {$undef ACME_array_decl}
               {$define ACME_array_decl:=array}
           {$endif}
     {$endif}

     {$ifndef ACME_array_type}
         {$define ACME_array_type:=byte}
     {$endif}

     {$ifdef ACME_bitconst}
        // we want to keep the X_bits constant
        const ACME_bitconst = ACME_bits; //X_bits
        {$ifdef ACME_high}
        // we want to keep the X_high constant
        const ACME_high = pred(1 shl ACME_bitconst);    //X_high
        type  ACME_type = 0..ACME_high;             //X
        {$else}
        // we don't care about keeping the X_high constant
        type  ACME_type = 0..pred(1 shl ACME_bitconst); //X
        {$endif}
    {$else}
       {$ifdef ACME_high}
          // we don't care about keeping the X_bits constant
          const ACME_high = pred(1 shl ACME_bits); //X_high
          type  ACME_type = 0..ACME_high;          //X
       {$else}
          // we don't care about keeping the X_high or X_bits constants
          type  ACME_type = 0..pred(1 shl ACME_bits); //X
       {$endif}
    {$endif}

    {$ifdef ACME_array}



      type  ACME_array = ACME_array_decl [ACME_type] of ACME_array_type;

      {$ifdef ACME_array_length}
          const ACME_array_length = sizeof(ACME_array);
      {$endif}


      {$ifdef ACME_array_pointer}
        type  ACME_array_pointer=^ACME_array;
      {$endif}

      {$undef ACME_array}
    {$endif}

{$undef ACME_type}
{$undef ACME_bitconst}
{$undef ACME_high}
{$undef ACME_bits}
{$undef ACME_packed_array}
{$undef ACME_bitpacked_array}
{$undef ACME_array}
{$undef ACME_array_pointer}
{$undef ACME_array_type}
{$undef ACME_array_decl}
{$undef ACME_array_length}
somefile.pas

{$macro on}

{$define  ACME_0:=TAllocationPatchIndex}
{$define  ACME_1:=TAllocationPatchIndex_bits}
{$define  ACME_2:=TAllocationPatchIndex_high}
{$define  ACME_3:=16}
{$Include ACME_Integer.inc} 

{$define  ACME_0:=TAllocationId}
{$define  ACME_1:=TAllocationId_bits}
{$define  ACME_2:=TAllocationId_high}
{$define  ACME_3:=28}
{$Include ACME_Integer.inc} 
{$macro on}

{$define  ACME_type:=TSha256IndexSliceMagic}
{$define  ACME_bitconst:=TSha256IndexSliceMagic_bits}
{$define  ACME_high:=TSha256IndexSliceMagic_high}
{$define  ACME_bits:=17}
{$Include ACME_Integer.inc}

{$define  ACME_type:=TSha256DataBufferIndex}
{$define  ACME_bitconst:=TSha256DataBufferIndex_bits}
{$define  ACME_high:=TSha256DataBufferIndex_high}
{$define  ACME_bits:=9}
{$define  ACME_packed_array:=TSha256DataBuffer}
{$define  ACME_array_pointer:=PSha256DataBuffer}
{$Include ACME_Integer.inc}        
扩展到

const TAllocationPatchIndex_bits = 16;
const TAllocationPatchIndex_high = pred(1 shl TAllocationPatchIndex_bits);
type  TAllocationPatchIndex= 0..TAllocationPatchIndex_high;

const TAllocationId_bits = 28;
const TAllocationId_high = pred(1 shl TAllocationId_bits);
type  TAllocationId= 0..TAllocationId_high;
const TSha256IndexSliceMagic_bits = 17;
const TSha256IndexSliceMagic_high = pred(1 shl TSha256IndexSliceMagic_bits);  
type  TSha256IndexSliceMagic= 0..TSha256IndexSliceMagic_high;


const TSha256DataBufferIndex_bits = 9;
const TSha256DataBufferIndex_high = pred(1 shl TSha256DataBufferIndex_bits);  
type  TSha256DataBufferIndex= 0..TSha256DataBufferIndex_high;
type  TSha256DataBuffer = packed array [TSha256DataBufferIndex] of byte;
type  PSha256DataBuffer = ^TSha256DataBuffer;
虽然这个示例使用的代码比它保存的代码要多,但是您可以明显地看到,include文件可能是非常复杂的重复代码,需要多次定制

更新-使用命名/可选参数的更复杂宏

{$macro on}

{$define  ACME_0:=TAllocationPatchIndex}
{$define  ACME_1:=TAllocationPatchIndex_bits}
{$define  ACME_2:=TAllocationPatchIndex_high}
{$define  ACME_3:=16}
{$Include ACME_Integer.inc} 

{$define  ACME_0:=TAllocationId}
{$define  ACME_1:=TAllocationId_bits}
{$define  ACME_2:=TAllocationId_high}
{$define  ACME_3:=28}
{$Include ACME_Integer.inc} 
{$macro on}

{$define  ACME_type:=TSha256IndexSliceMagic}
{$define  ACME_bitconst:=TSha256IndexSliceMagic_bits}
{$define  ACME_high:=TSha256IndexSliceMagic_high}
{$define  ACME_bits:=17}
{$Include ACME_Integer.inc}

{$define  ACME_type:=TSha256DataBufferIndex}
{$define  ACME_bitconst:=TSha256DataBufferIndex_bits}
{$define  ACME_high:=TSha256DataBufferIndex_high}
{$define  ACME_bits:=9}
{$define  ACME_packed_array:=TSha256DataBuffer}
{$define  ACME_array_pointer:=PSha256DataBuffer}
{$Include ACME_Integer.inc}        
ACME\u Integer.inc

const ACME_1 = ACME_3;
const ACME_2 = pred(1 shl ACME_1);
type  ACME_0 = 0..ACME_2;
//clear the passed in parameters so they can be reused in the next inclusion
{$undef ACME_0}{$undef ACME_1}{$undef ACME_2}{$undef ACME_3}           
     {$ifdef ACME_packed_array}
         {$undef ACME_array}
         {$define ACME_array:=ACME_packed_array}

         {$undef ACME_array_decl}
         {$define ACME_array_decl:=packed array}
     {$else}

          {$ifdef ACME_bitpacked_array}

             {$undef ACME_array}
             {$define ACME_array:=ACME_bitpacked_array}

             {$undef ACME_array_decl}
             {$define ACME_array_decl:=bitpacked array}

           {$else}
               {$undef ACME_array_decl}
               {$define ACME_array_decl:=array}
           {$endif}
     {$endif}

     {$ifndef ACME_array_type}
         {$define ACME_array_type:=byte}
     {$endif}

     {$ifdef ACME_bitconst}
        // we want to keep the X_bits constant
        const ACME_bitconst = ACME_bits; //X_bits
        {$ifdef ACME_high}
        // we want to keep the X_high constant
        const ACME_high = pred(1 shl ACME_bitconst);    //X_high
        type  ACME_type = 0..ACME_high;             //X
        {$else}
        // we don't care about keeping the X_high constant
        type  ACME_type = 0..pred(1 shl ACME_bitconst); //X
        {$endif}
    {$else}
       {$ifdef ACME_high}
          // we don't care about keeping the X_bits constant
          const ACME_high = pred(1 shl ACME_bits); //X_high
          type  ACME_type = 0..ACME_high;          //X
       {$else}
          // we don't care about keeping the X_high or X_bits constants
          type  ACME_type = 0..pred(1 shl ACME_bits); //X
       {$endif}
    {$endif}

    {$ifdef ACME_array}



      type  ACME_array = ACME_array_decl [ACME_type] of ACME_array_type;

      {$ifdef ACME_array_length}
          const ACME_array_length = sizeof(ACME_array);
      {$endif}


      {$ifdef ACME_array_pointer}
        type  ACME_array_pointer=^ACME_array;
      {$endif}

      {$undef ACME_array}
    {$endif}

{$undef ACME_type}
{$undef ACME_bitconst}
{$undef ACME_high}
{$undef ACME_bits}
{$undef ACME_packed_array}
{$undef ACME_bitpacked_array}
{$undef ACME_array}
{$undef ACME_array_pointer}
{$undef ACME_array_type}
{$undef ACME_array_decl}
{$undef ACME_array_length}
somefile.pas

{$macro on}

{$define  ACME_0:=TAllocationPatchIndex}
{$define  ACME_1:=TAllocationPatchIndex_bits}
{$define  ACME_2:=TAllocationPatchIndex_high}
{$define  ACME_3:=16}
{$Include ACME_Integer.inc} 

{$define  ACME_0:=TAllocationId}
{$define  ACME_1:=TAllocationId_bits}
{$define  ACME_2:=TAllocationId_high}
{$define  ACME_3:=28}
{$Include ACME_Integer.inc} 
{$macro on}

{$define  ACME_type:=TSha256IndexSliceMagic}
{$define  ACME_bitconst:=TSha256IndexSliceMagic_bits}
{$define  ACME_high:=TSha256IndexSliceMagic_high}
{$define  ACME_bits:=17}
{$Include ACME_Integer.inc}

{$define  ACME_type:=TSha256DataBufferIndex}
{$define  ACME_bitconst:=TSha256DataBufferIndex_bits}
{$define  ACME_high:=TSha256DataBufferIndex_high}
{$define  ACME_bits:=9}
{$define  ACME_packed_array:=TSha256DataBuffer}
{$define  ACME_array_pointer:=PSha256DataBuffer}
{$Include ACME_Integer.inc}        
扩展到

const TAllocationPatchIndex_bits = 16;
const TAllocationPatchIndex_high = pred(1 shl TAllocationPatchIndex_bits);
type  TAllocationPatchIndex= 0..TAllocationPatchIndex_high;

const TAllocationId_bits = 28;
const TAllocationId_high = pred(1 shl TAllocationId_bits);
type  TAllocationId= 0..TAllocationId_high;
const TSha256IndexSliceMagic_bits = 17;
const TSha256IndexSliceMagic_high = pred(1 shl TSha256IndexSliceMagic_bits);  
type  TSha256IndexSliceMagic= 0..TSha256IndexSliceMagic_high;


const TSha256DataBufferIndex_bits = 9;
const TSha256DataBufferIndex_high = pred(1 shl TSha256DataBufferIndex_bits);  
type  TSha256DataBufferIndex= 0..TSha256DataBufferIndex_high;
type  TSha256DataBuffer = packed array [TSha256DataBufferIndex] of byte;
type  PSha256DataBuffer = ^TSha256DataBuffer;

您可以使用宏和include的组合来实现类似于标记粘贴的功能

ACME\u Integer.inc

const ACME_1 = ACME_3;
const ACME_2 = pred(1 shl ACME_1);
type  ACME_0 = 0..ACME_2;
//clear the passed in parameters so they can be reused in the next inclusion
{$undef ACME_0}{$undef ACME_1}{$undef ACME_2}{$undef ACME_3}           
     {$ifdef ACME_packed_array}
         {$undef ACME_array}
         {$define ACME_array:=ACME_packed_array}

         {$undef ACME_array_decl}
         {$define ACME_array_decl:=packed array}
     {$else}

          {$ifdef ACME_bitpacked_array}

             {$undef ACME_array}
             {$define ACME_array:=ACME_bitpacked_array}

             {$undef ACME_array_decl}
             {$define ACME_array_decl:=bitpacked array}

           {$else}
               {$undef ACME_array_decl}
               {$define ACME_array_decl:=array}
           {$endif}
     {$endif}

     {$ifndef ACME_array_type}
         {$define ACME_array_type:=byte}
     {$endif}

     {$ifdef ACME_bitconst}
        // we want to keep the X_bits constant
        const ACME_bitconst = ACME_bits; //X_bits
        {$ifdef ACME_high}
        // we want to keep the X_high constant
        const ACME_high = pred(1 shl ACME_bitconst);    //X_high
        type  ACME_type = 0..ACME_high;             //X
        {$else}
        // we don't care about keeping the X_high constant
        type  ACME_type = 0..pred(1 shl ACME_bitconst); //X
        {$endif}
    {$else}
       {$ifdef ACME_high}
          // we don't care about keeping the X_bits constant
          const ACME_high = pred(1 shl ACME_bits); //X_high
          type  ACME_type = 0..ACME_high;          //X
       {$else}
          // we don't care about keeping the X_high or X_bits constants
          type  ACME_type = 0..pred(1 shl ACME_bits); //X
       {$endif}
    {$endif}

    {$ifdef ACME_array}



      type  ACME_array = ACME_array_decl [ACME_type] of ACME_array_type;

      {$ifdef ACME_array_length}
          const ACME_array_length = sizeof(ACME_array);
      {$endif}


      {$ifdef ACME_array_pointer}
        type  ACME_array_pointer=^ACME_array;
      {$endif}

      {$undef ACME_array}
    {$endif}

{$undef ACME_type}
{$undef ACME_bitconst}
{$undef ACME_high}
{$undef ACME_bits}
{$undef ACME_packed_array}
{$undef ACME_bitpacked_array}
{$undef ACME_array}
{$undef ACME_array_pointer}
{$undef ACME_array_type}
{$undef ACME_array_decl}
{$undef ACME_array_length}
somefile.pas

{$macro on}

{$define  ACME_0:=TAllocationPatchIndex}
{$define  ACME_1:=TAllocationPatchIndex_bits}
{$define  ACME_2:=TAllocationPatchIndex_high}
{$define  ACME_3:=16}
{$Include ACME_Integer.inc} 

{$define  ACME_0:=TAllocationId}
{$define  ACME_1:=TAllocationId_bits}
{$define  ACME_2:=TAllocationId_high}
{$define  ACME_3:=28}
{$Include ACME_Integer.inc} 
{$macro on}

{$define  ACME_type:=TSha256IndexSliceMagic}
{$define  ACME_bitconst:=TSha256IndexSliceMagic_bits}
{$define  ACME_high:=TSha256IndexSliceMagic_high}
{$define  ACME_bits:=17}
{$Include ACME_Integer.inc}

{$define  ACME_type:=TSha256DataBufferIndex}
{$define  ACME_bitconst:=TSha256DataBufferIndex_bits}
{$define  ACME_high:=TSha256DataBufferIndex_high}
{$define  ACME_bits:=9}
{$define  ACME_packed_array:=TSha256DataBuffer}
{$define  ACME_array_pointer:=PSha256DataBuffer}
{$Include ACME_Integer.inc}        
扩展到

const TAllocationPatchIndex_bits = 16;
const TAllocationPatchIndex_high = pred(1 shl TAllocationPatchIndex_bits);
type  TAllocationPatchIndex= 0..TAllocationPatchIndex_high;

const TAllocationId_bits = 28;
const TAllocationId_high = pred(1 shl TAllocationId_bits);
type  TAllocationId= 0..TAllocationId_high;
const TSha256IndexSliceMagic_bits = 17;
const TSha256IndexSliceMagic_high = pred(1 shl TSha256IndexSliceMagic_bits);  
type  TSha256IndexSliceMagic= 0..TSha256IndexSliceMagic_high;


const TSha256DataBufferIndex_bits = 9;
const TSha256DataBufferIndex_high = pred(1 shl TSha256DataBufferIndex_bits);  
type  TSha256DataBufferIndex= 0..TSha256DataBufferIndex_high;
type  TSha256DataBuffer = packed array [TSha256DataBufferIndex] of byte;
type  PSha256DataBuffer = ^TSha256DataBuffer;
虽然这个示例使用的代码比它保存的代码要多,但是您可以明显地看到,include文件可能是非常复杂的重复代码,需要多次定制

更新-使用命名/可选参数的更复杂宏

{$macro on}

{$define  ACME_0:=TAllocationPatchIndex}
{$define  ACME_1:=TAllocationPatchIndex_bits}
{$define  ACME_2:=TAllocationPatchIndex_high}
{$define  ACME_3:=16}
{$Include ACME_Integer.inc} 

{$define  ACME_0:=TAllocationId}
{$define  ACME_1:=TAllocationId_bits}
{$define  ACME_2:=TAllocationId_high}
{$define  ACME_3:=28}
{$Include ACME_Integer.inc} 
{$macro on}

{$define  ACME_type:=TSha256IndexSliceMagic}
{$define  ACME_bitconst:=TSha256IndexSliceMagic_bits}
{$define  ACME_high:=TSha256IndexSliceMagic_high}
{$define  ACME_bits:=17}
{$Include ACME_Integer.inc}

{$define  ACME_type:=TSha256DataBufferIndex}
{$define  ACME_bitconst:=TSha256DataBufferIndex_bits}
{$define  ACME_high:=TSha256DataBufferIndex_high}
{$define  ACME_bits:=9}
{$define  ACME_packed_array:=TSha256DataBuffer}
{$define  ACME_array_pointer:=PSha256DataBuffer}
{$Include ACME_Integer.inc}        
ACME\u Integer.inc

const ACME_1 = ACME_3;
const ACME_2 = pred(1 shl ACME_1);
type  ACME_0 = 0..ACME_2;
//clear the passed in parameters so they can be reused in the next inclusion
{$undef ACME_0}{$undef ACME_1}{$undef ACME_2}{$undef ACME_3}           
     {$ifdef ACME_packed_array}
         {$undef ACME_array}
         {$define ACME_array:=ACME_packed_array}

         {$undef ACME_array_decl}
         {$define ACME_array_decl:=packed array}
     {$else}

          {$ifdef ACME_bitpacked_array}

             {$undef ACME_array}
             {$define ACME_array:=ACME_bitpacked_array}

             {$undef ACME_array_decl}
             {$define ACME_array_decl:=bitpacked array}

           {$else}
               {$undef ACME_array_decl}
               {$define ACME_array_decl:=array}
           {$endif}
     {$endif}

     {$ifndef ACME_array_type}
         {$define ACME_array_type:=byte}
     {$endif}

     {$ifdef ACME_bitconst}
        // we want to keep the X_bits constant
        const ACME_bitconst = ACME_bits; //X_bits
        {$ifdef ACME_high}
        // we want to keep the X_high constant
        const ACME_high = pred(1 shl ACME_bitconst);    //X_high
        type  ACME_type = 0..ACME_high;             //X
        {$else}
        // we don't care about keeping the X_high constant
        type  ACME_type = 0..pred(1 shl ACME_bitconst); //X
        {$endif}
    {$else}
       {$ifdef ACME_high}
          // we don't care about keeping the X_bits constant
          const ACME_high = pred(1 shl ACME_bits); //X_high
          type  ACME_type = 0..ACME_high;          //X
       {$else}
          // we don't care about keeping the X_high or X_bits constants
          type  ACME_type = 0..pred(1 shl ACME_bits); //X
       {$endif}
    {$endif}

    {$ifdef ACME_array}



      type  ACME_array = ACME_array_decl [ACME_type] of ACME_array_type;

      {$ifdef ACME_array_length}
          const ACME_array_length = sizeof(ACME_array);
      {$endif}


      {$ifdef ACME_array_pointer}
        type  ACME_array_pointer=^ACME_array;
      {$endif}

      {$undef ACME_array}
    {$endif}

{$undef ACME_type}
{$undef ACME_bitconst}
{$undef ACME_high}
{$undef ACME_bits}
{$undef ACME_packed_array}
{$undef ACME_bitpacked_array}
{$undef ACME_array}
{$undef ACME_array_pointer}
{$undef ACME_array_type}
{$undef ACME_array_decl}
{$undef ACME_array_length}
somefile.pas

{$macro on}

{$define  ACME_0:=TAllocationPatchIndex}
{$define  ACME_1:=TAllocationPatchIndex_bits}
{$define  ACME_2:=TAllocationPatchIndex_high}
{$define  ACME_3:=16}
{$Include ACME_Integer.inc} 

{$define  ACME_0:=TAllocationId}
{$define  ACME_1:=TAllocationId_bits}
{$define  ACME_2:=TAllocationId_high}
{$define  ACME_3:=28}
{$Include ACME_Integer.inc} 
{$macro on}

{$define  ACME_type:=TSha256IndexSliceMagic}
{$define  ACME_bitconst:=TSha256IndexSliceMagic_bits}
{$define  ACME_high:=TSha256IndexSliceMagic_high}
{$define  ACME_bits:=17}
{$Include ACME_Integer.inc}

{$define  ACME_type:=TSha256DataBufferIndex}
{$define  ACME_bitconst:=TSha256DataBufferIndex_bits}
{$define  ACME_high:=TSha256DataBufferIndex_high}
{$define  ACME_bits:=9}
{$define  ACME_packed_array:=TSha256DataBuffer}
{$define  ACME_array_pointer:=PSha256DataBuffer}
{$Include ACME_Integer.inc}        
扩展到

const TAllocationPatchIndex_bits = 16;
const TAllocationPatchIndex_high = pred(1 shl TAllocationPatchIndex_bits);
type  TAllocationPatchIndex= 0..TAllocationPatchIndex_high;

const TAllocationId_bits = 28;
const TAllocationId_high = pred(1 shl TAllocationId_bits);
type  TAllocationId= 0..TAllocationId_high;
const TSha256IndexSliceMagic_bits = 17;
const TSha256IndexSliceMagic_high = pred(1 shl TSha256IndexSliceMagic_bits);  
type  TSha256IndexSliceMagic= 0..TSha256IndexSliceMagic_high;


const TSha256DataBufferIndex_bits = 9;
const TSha256DataBufferIndex_high = pred(1 shl TSha256DataBufferIndex_bits);  
type  TSha256DataBufferIndex= 0..TSha256DataBufferIndex_high;
type  TSha256DataBuffer = packed array [TSha256DataBufferIndex] of byte;
type  PSha256DataBuffer = ^TSha256DataBuffer;

你不想这样做。这是一个可怕的想法在C++中。不要抄袭坏主意。从程序员指南的第1.2.48节:“在{$Grace}状态中,编译器允许使用C风格(虽然不是很复杂)宏。”注意“不是那么复杂”。部分。我不认为参数是支持的。@ DavidHeffernan TBH,C和C++中的宏是保存优雅。当然它可以被滥用,但是明智地使用,宏可以将复杂的操作转换到编译阶段,加速执行,尽管代码大小可能增加。AyHooo…有一个方法可以在Fielasalk中看到。NSWER你不想这样做。这是一个可怕的想法在C++中。不要抄袭坏主意。从程序员指南的第1.2.48节:“在{$Grace}状态中,编译器允许使用C风格(虽然不是很复杂)宏。”注意“不是那么复杂”。部分。我不认为参数是支持的。@ DavidHeffernan TBH,C和C++中的宏是保存优雅。当然它可以被滥用,但是明智地使用,宏可以将复杂的操作转换到编译阶段,加速执行,尽管代码大小可能增加。AyHooo…有一个方法可以在Fielasalk中看到。NSWER感谢你的回答。我只想在PASCAL中编写一些模板,比如C++ +哈哈哈。我只会使用函数和过程。FPC有泛型。谢谢你的回答。我只想在PASCAL中用C++编写一些模板。我只会使用函数和过程。FPC有泛型。