我贴一个  PTypeData = ^TTypeData;
  TTypeData = packed record
    case TTypeKind of
      tkUnknown, tkLString, tkWString, tkVariant: ();
      tkInteger, tkChar, tkEnumeration, tkSet, tkWChar: (
        OrdType: TOrdType;
        case TTypeKind of
          tkInteger, tkChar, tkEnumeration, tkWChar: (
            MinValue: Longint;
            MaxValue: Longint;
            case TTypeKind of
              tkInteger, tkChar, tkWChar: ();
              tkEnumeration: (
                BaseType: PPTypeInfo;
                NameList: ShortStringBase));
          tkSet: (
            CompType: PPTypeInfo));
      tkFloat: (
        FloatType: TFloatType);
      tkString: (
        MaxLength: Byte);
      tkClass: (
        ClassType: TClass;
        ParentInfo: PPTypeInfo;
        PropCount: SmallInt;
        UnitName: ShortStringBase;
       {PropData: TPropData});
      tkMethod: (
        MethodKind: TMethodKind;
        ParamCount: Byte;
        ParamList: array[0..1023] of Char
       {ParamList: array[1..ParamCount] of
          record
            Flags: TParamFlags;
            ParamName: ShortString;
            TypeName: ShortString;
          end;
        ResultType: ShortString});
      tkInterface: (
        IntfParent : PPTypeInfo; { ancestor }
        IntfFlags : TIntfFlagsBase;
        Guid : TGUID;
        IntfUnit : ShortStringBase;
       {PropData: TPropData});
      tkInt64: (
        MinInt64Value, MaxInt64Value: Int64);
  end;

解决方案 »

  1.   

    这个好像叫 Union 联合吧
    联合里面可以套联合的。
      

  2.   

        case Byte of
          0: (h_addr_list: ^PChar);
          1: (h_addr: ^PChar)
    是什么意思呢
      

  3.   

    常见的:
      TRect = record
        case Integer of
          0: (Left, Top, Right, Bottom: Integer);
          1: (TopLeft, BottomRight: TPoint);
      end;
    第一组的数据 (Left, Top, Right, Bottom: Integer) 
    和第二组数据(TopLeft, BottomRight: TPoint)使用的是同一块内存。
    只是访问的方式不一样。
      

  4.   

    case Byte of
          0: (h_addr_list: ^PChar);
          1: (h_addr: ^PChar)
    表示 记录 可以提供一个 h_addr_list 名称的字段,
       也可以提供 h_addr 名称的字段 ,以便访问.
      

  5.   

    就是说:
    如果是16位的,就是  hostent = record
        h_name: PChar;
        h_aliases: ^PChar;
        h_addrtype: Smallint;
        h_length: Smallint;
        h_addr_list: ^PChar);
      end;
    如果是32位的:
    }
      hostent = record
        h_name: PChar;
        h_aliases: ^PChar;
        h_addrtype: Smallint;
        h_length: Smallint;
        h_addr: ^PChar ;
      end;
      
      
      

  6.   

    那什么时候用case Byte,什么时候用case Integer呢?我记得还见过
    case Boolean of 
    True :.................
    False:.................
    end ;
    的情况,有什么讲究吗?
      

  7.   

      这是一个关于纪录变体的问题,如果你想详细了解,请参阅《Pascal程序设计》第二版 郑启华编,清华版 第200页。
      一个纪录可包括固定部分和变体部分,固定部分的域对该类型的所有变量是同样的,而变体部分的域对各个变量是不一定相同的,所以用到了Case进行条件选择,例子就不用写了吧,上面都很详细了。
      

  8.   

    建议所有想学好Delphi的程序员:
    第一步:Pascal
    第二步:Object Pascal
    第三步:VCL