there doesn't seem to be much sense in FPC's typecasting system.
For instance, in the following:
const
ASignature = DWORD('abcd'); { it doesn't accept this }
ASignature = DWORD('a'); { but it accepts this }
ABoolean = boolean('a'); { this is also acceptable, really ??? }
var
ASignatureVar : DWORD;
ABooleanVar : boolean;
ABoolean32Var : boolean32;
begin
ASignatureVar := DWORD('abcd'); { it accepts this. ok for a var but not for a constant ? that makes a lot of sense ;-) }
ASignatureVar := DWORD('abcde'); { it doesn't accept this, which is good }
ASignatureVar := DWORD('a'); { it accepts this }
ASignatureVar := DWORD('ab'); { it doesn't accept this, why not ? 'a' is fine but 'ab' isn't ? }
ABooleanVar := boolean('a'); { typecast a character into a boolean ... NO problem... LOL }
ABoolean32Var := boolean32('abcd'); { another jewel }
Time to have some fun:
1. In a constant, you cannot typecast "abcd" into a DWORD but, you can do exactly that cast in a DWORD variable.
2. In a constant, you CAN typecast "a" into a DWORD. Basically, DWORD is working like "ord"
3. typecasting "abcde" to a DWORD variable is not acceptable (which is good because of the size, i.e, the extra "e")
4. typecasting "a" to a DWORD variable is acceptable (that's questionable because the size isn't right but, seems like DWORD is sort of equal to "ord")
5. typecasting "ab" to a DWORD variable is NOT acceptable. if it accepts "a" and "abcd" then why doesn't it accept "ab" and "abc" ???? It should zero pad the value just as it did when there was only "a".
it looks like between "a" and "abcd" all there is, is, "undefined territory".

6. and there is no problem typecasting a character or character string to a boolean. In FPC, booleans are 0, 1 and "abcd" and any other string that fits (never mind it's a string... that's "perfectly" fine... who could possibly expect a compiler for a strongly typed language to catch such an error ???) Some strong type checking there!