maXcomX

Member since: Thursday, 05 November 2015
Last login: Never logged in.
Profile viewed: 500 views

No Rank
Points: 0

maXcomX created a new topic ' Weird Delphi experience' in the forum. 6 years ago

A weird thing is that no matter what type is given, a value from an enum will not combine with any Delphi type. In D7 I had never problems with that, unless I misinterpret the C/++ API. What only results in a not working API-call. For example: the compiler (XE 7) generates two issues about this statement: if (pDesc.SampleFormat.SampleFormat = DXVA2_SampleFieldInterleavedEvenFirst) or (pDesc.SampleFormat.SampleFormat = DXVA2_SampleFieldInterleavedOddFirst) then pDesc.OutputFrameFreq.Numerator:= 2; Here the pDesc.SampleFormat.SampleFormat represents an integer, while the DXVA2_SampleFieldInterleavedEvenFirst is a converted C struct enum member - In delphi words: a record), representing 3 (DXVA2_SampleFieldInterleavedEvenFirst = 3) The same for pDesc.SampleFormat.SampleFormat and DXVA2_SampleFieldInterleavedOddFirst (4) Now this what the compiler generates: Error 1: [dcc32 Error] DxVa2Api.pas(1016): E2008 Incompatible types (twice) (I guess pDesc.SampleFormat.SampleFormat is not compatible with DXVA2_SampleFieldInterleavedEvenFirst; and so on. Error 2: [dcc32 Error] DxVa2Api.pas(1017): E2012 Type of expression must be BOOLEAN The whole If .. then comparison is not of a boolean type...? I cry my hart out: Who implemented this compiler thingy to say that a comparison between two values can not be true or false (a boolean result) ? Because that is what I wrote correctly (even in Spanish - no offence to Spanish speaking- ) Maybe one have a clue?

Read More...

maXcomX created a new topic ' Weird experience' in the forum. 6 years ago

A weird thing is that no matter what type is given, a value from an enum will not combine with any Delphi type. In D7 I had never problems with that, unless I misinterpret the C/++ API. What only results in a not working API-call.

For example: the compiler (XE 7) generates two issues about this statement:

if (pDesc.SampleFormat.SampleFormat = DXVA2_SampleFieldInterleavedEvenFirst) or
(pDesc.SampleFormat.SampleFormat = DXVA2_SampleFieldInterleavedOddFirst) then
pDesc.OutputFrameFreq.Numerator:= 2;

Here the pDesc.SampleFormat.SampleFormat represents an integer, while the DXVA2_SampleFieldInterleavedEvenFirst is a converted C struct enum member - In delphi words: a record), representing 3 (DXVA2_SampleFieldInterleavedEvenFirst = 3)
The same for pDesc.SampleFormat.SampleFormat and DXVA2_SampleFieldInterleavedOddFirst (4)

Now this what the compiler generates:
Error 1:
[dcc32 Error] DxVa2Api.pas(1016): E2008 Incompatible types (twice)

(I guess pDesc.SampleFormat.SampleFormat is not compatible with DXVA2_SampleFieldInterleavedEvenFirst; and so on.

Error 2:
[dcc32 Error] DxVa2Api.pas(1017): E2012 Type of expression must be BOOLEAN
The whole If .. then comparison is not of a boolean type...?

I cry my hart out: Who implemented this compiler thingy to say that a comparison between two values can not be true or false (a boolean result) ?
Because that is what I wrote correctly (even in Spanish - no offence to Spanish speaking- )

Maybe one have a clue?

Read More...