[WayBack] dutchdelphidude on Twitter: “ik doe nu dit ermee nefertiti-tradebot.com … “
–jeroen
Posted by jpluimers on 2021/05/12
Posted in Development, Go (golang), Software Development | Leave a Comment »
Posted by jpluimers on 2021/05/12
Quite a while back, @NS_Online (Dutch railroads) did not accept plus signs in email addresses. I verified a few times over the years and not much progress.
This is a reminder to myself to re-check.
Edit 20230418: it has started working, see further below.
Below the fold the Twitter thread that started with [WayBack] Jeroen Pluimers on Twitter: “Toch jammer dat @NS_online valide email adressen met een plus-teken erin weigert.… “
Hopefully by now they retraced themselves from the bad company of many other parties failing to adhere to clear and long existing internet standards: [WayBack] User:Me at work/plushaters | Mozilla Community | FANDOM powered by Wikia.
Their web care team and their developers made some very inexcusable assumptions there:
Some links on email addresses and their validity:
Posted in Development, Power User, Software Development, Web Development | Leave a Comment »
Posted by jpluimers on 2021/05/12
(Tagged FastMM4 as that’s the first code I saw these warnings to be turned off)
Delphi 7 introduced introduced warnings for unsafe constructs like W1047 and W1048 so you could prepare your code for the first Delphi .NET compilers .
The oldest online documentation on this is in Delphi 2007:
Type Switch Syntax{$UNSAFECODE ON}
or
{$UNSAFECODE OFF}
Default{$UNSAFECODE OFF}
Scope Local
You have used a data type or operation for which static code analysis cannot prove that it does not overwrite memory. In a secured execution environment such as .NET, such code is assumed to be unsafe and a potential security risk.
You have used a data type or operation for which static code analysis cannot prove that it does not overwrite memory. In a secured execution environment such as .NET, such code is assumed to be unsafe and a potential security risk.
You have used a data type or operation for which static code analysis cannot prove that it does not overwrite memory. In a secured execution environment such as .NET, such code is assumed to be unsafe and a potential security risk.
After Delphi 2007, the .NET compiler got shelved, but the errors and warning stayed as they serve a good purpose for native code as well.
Delphi 2007 did not document any of the other directives.
Unlike the D2007 documentation, however, the UNSAFECODE
should be written UNSAFE_CODE
as with using {$WARN UNSAFECODE ON}
, you will get this error:
E1030 Invalid compiler directive: 'UNSAFECODE'
Looking at the library code and example code that ships with Delphi, these are the valid $WARN
compiler directives having to do with UNSAFE
:
UNSAFE_CAST
(since Delphi 7, but only used in Vcl.WinXPanels.pas introduced in Delphi 10.2 Tokyo and up)UNSAFE_CODE
(since Delphi 7, but still documented as UNSAFECODE
)UNSAFE_TYPE
(since Delphi 7)UNSAFE_VOID_POINTER
(since Delphi XE3, as precursor to the NEXTGEN compilers)The ultimate source for these is the file DCCStrs.pas that has shipped since Delphi 2009: [WayBack] warnings – Identifiers for Delphi’s $WARN compiler directive – Stack Overflow.
A problem is that current documentation still lists the wrong name in many places:
- UNSAFE_TYPE
- UNSAFE_CODE
- UNSAFE_CAST
This one finally got it right: [WayBack] Warning messages (Delphi) – RAD Studio
UNSAFE_TYPE
W1046 UNSAFE_CODE
W1047 UNSAFE_CAST
W1048
Note it also documented UNSAFE_VOID_POINTER
:
UNSAFE_VOID_POINTER
W1070 [WayBack] W1070 Use of untype pointer can disrupt instance reference counts (Delphi) – RAD Studio
And these warning messages still do not contain the directives, but do explain the underlying code construct better:
You have used a data type or operation for which static code analysis cannot prove that it does not overwrite memory. For example, you might receive this warning if you declare something as absolute. Such code can be considered a security risk.
You have used a data type or operation for which static code analysis cannot prove that it does not overwrite memory. Such code can be considered a security risk.For example, using GetMem can elicit this warning because a block of memory has no associated type.
You have used a data type or operation for which static code analysis cannot prove that it does not overwrite memory. For example, you might have cased one record to another or one instance to another.
You have to use these directives:
// Get rid of "W1047 Unsafe code 'ASM'", "W1047 Unsafe code '^ operator'", "W1047 Unsafe code '@ operator'" and similar {$WARN UNSAFE_CODE OFF} // Get rid of "W1048 Unsafe typecast of 'TFreedObject' to 'PByte'" and similar {$WARN UNSAFE_CAST OFF}
Back in the days, some people were not amused and disabled the warnings, for instance in [Archive.is] Re: How can I eliminate these warnings in Delphi 7 which did not appear in Delphi 5. – Google Groups:
Dennis Passmore:I have one include file that I usually include in all projects as follows—– WarningsOff.inc —————-
{$IFDEF CONDITIONALEXPRESSIONS}
{$IF CompilerVersion >= 14}
{$WARN SYMBOL_PLATFORM OFF}
{$WARN SYMBOL_DEPRECATED OFF}
{$WARN SYMBOL_LIBRARY OFF}
{$WARN UNIT_DEPRECATED OFF}
{$WARN UNIT_LIBRARY OFF}
{$WARN UNIT_PLATFORM OFF}
{$WARN UNSAFE_TYPE OFF}
{$WARN UNSAFE_CODE OFF}
{$WARN UNSAFE_CAST OFF}
{$IFEND}
{$ENDIF}
———————and it gets ride of all unwanted warnings in the IDE or even DCC32.exe when compiling the project
from the command line.I just add the following line to the project .dpr file and do not worry about the rest.
{$I WarningsOff.inc}
Dennis Passmore
“If you cannot conceive the idea you
will never achieve the desired results”
I disagree with such an approach, as those warnings have their purpose.
Knowing how to selectively disable/enable them however, is important.
–jeroen
Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | Leave a Comment »