Forum > General
AV during runtime, because Compiler does not check the String-Format by "Format"
paule32:
Hello,
- I download, and compile the latest FPC 3.2.2
- I faced with Format - a string operation function in following way:
Format('text: %d', [ IntToStr( aLongIntVariable ) ]);
I get no Compiler error.
But I get AV during runtime - else:
Format('text: %s', [ IntToStr( aLongIntVariable ) ]);
the format will not checked during compile.
But I get no AV during runtime.
Is there a possibility, to set a switch or option, that check the format of the string
within the Format function ?
440bx:
--- Quote from: paule32 on April 04, 2024, 12:57:34 pm ---Is there a possibility, to set a switch or option, that check the format of the string
within the Format function ?
--- End quote ---
C++ can do it but, I don't think the FPC compiler checks variadic parameters.
paule32:
I wonder me, why FPC don't.
In context, that FPC supports Generics and Co. ...
PascalDragon:
--- Quote from: paule32 on April 04, 2024, 12:57:34 pm ---Is there a possibility, to set a switch or option, that check the format of the string
within the Format function ?
--- End quote ---
Format is no magic function, it's just an ordinary function implemented completely in Pascal. The compiler has no knowledge what Format does, thus it can not do any checks.
paule32:
and, how Assert work ? - is it a RTL Function, too ?
Navigation
[0] Message Index
[#] Next page