0
이 잘못된 타입 변환 오류를 어떻게 수정합니까? 이 코드는 집합에 31 개 미만의 항목이있을 때 작동합니다. 아래는 코드입니다 : Delphi가 잘못된 타입 변환을 설정하십시오
type
TOptionsSurveyTypes=(
ostLoadSurvey00,
ostLoadSurvey01,
ostLoadSurvey02,
ostLoadSurvey03,
ostLoadSurvey04,
ostLoadSurvey05,
ostLoadSurvey06,
ostLoadSurvey07,
ostLoadSurvey08,
ostLoadSurvey09,
ostLoadSurvey10,
ostEventLog01,
ostEventLog02,
ostEventLog03,
ostEventLog04,
ostEventLog05,
ostSagSwell,
ostTamper,
ostWaveforms,
ostDeviceList,
ostDeleteData,
ostTOUBillingTotal,
ostTOUPrevious,
ostProfileGenericLoadSurvey01,
ostProfileGenericLoadSurvey02,
ostProfileGenericLoadSurvey03,
ostProfileGenericLoadSurvey04,
ostProfileGenericLoadSurvey05,
ostProfileGenericLoadSurvey06,
ostProfileGenericLoadSurvey07,
ostProfileGenericLoadSurvey08,
ostProfileGenericLoadSurvey09,
ostProfileGenericLoadSurvey10,
ostProfileGenericEventLog01,
ostProfileGenericEventLog02,
ostProfileGenericEventLog03,
ostProfileGenericEventLog04,
ostProfileGenericEventLog05,
ostProfileGenericBillingTotal,
ostProfileGenericPrevious,
ostProfileGeneric
);
TOptionsSurveyTypesSet=set of TOptionsSurveyTypes;
function TUserProcessRollback.SurveyRollBack:boolean;
var
vRollbackDate: TDateTime;
FOptions: LongWord;
begin
...
if ostDeleteData in TOptionsSurveyTypesSet(FOptions) then <-- invalid typecast error here
vRollbackDate := 0.00
else
vRollbackDate := FRollbackDate;
...
end;
나는 세트가 줄여
그냥 미만 32 개 항목과 FOptions가 DWORD로 선언하는 코드는 컴파일합니다.감사합니다.
설명해 주셔서 감사합니다. 그러나 FOptions을 Longword로 변경하더라도 어떻게 컴파일됩니까? – user474079
DWORD는 Longword의 별명입니다. 이러한 유형의 유형 변환을 컴파일하려면 두 유형 모두 동일한 바이트 수를 가져야합니다. DWORD 및 Longword는 4 바이트입니다. SET 유형은 6 바이트입니다. –