requiring "overload" modifier lazarus / 62-General ---------------------------------------------------------------------- 440bx · 2021-10-06 06:22 Hello, I was wondering if it was possible to instruct FPC to always require the "overload" modifier to overload functions. IOW, is there some way to instruct the compiler to reject a function overload (even in the same unit) unless one or both of them are marked as "overload" ? Thank you for your help. ---------------------------------------------------------------------- Thaddy · 2021-10-06 06:41 Change the mode to {$mode delphi}. That should do the trick. (There may be a modeswitch for it too) ---------------------------------------------------------------------- PascalDragon · 2021-10-06 06:46 Quote from: 440bx on October 06, 2021, 08:22:32 amI was wondering if it was possible to instruct FPC to always require the "overload" modifier to overload functions. IOW, is there some way to instruct the compiler to reject a function overload (even in the same unit) unless one or both of them are marked as "overload" ? Use neither FPC nor ObjFPC mode as all other modes require the overload modifier. ---------------------------------------------------------------------- 440bx · 2021-10-06 06:59 Quote from: Thaddy on October 06, 2021, 08:41:08 amChange the mode to {$mode delphi}. That should do the trick. (There may be a modeswitch for it too) Thank you Thaddy but, {$mode delphi} is something I really don't want to use.  I want my pchars to be pchars, not pwidechars (or panything else for that matter.) Quote from: PascalDragon on October 06, 2021, 08:46:44 amUse neither FPC nor ObjFPC mode as all other modes require the overload modifier. Thank you PascalDragon.  What mode should I use (including any modeswitches if necessary) to get the features of mode FPC and have the compiler require the use of the "overload" modifier ?  (please don't say "mode delphi".. ) ---------------------------------------------------------------------- Bart · 2021-10-06 07:21 Quote from: 440bx on October 06, 2021, 08:59:25 amThank you Thaddy but, {$mode delphi} is something I really don't want to use.  I want my pchars to be pchars, not pwidechars (or panything else for that matter.) PChars are only PWideChars in {$mode DelphiUnicode}, not in plain {$mode Delphi} AFAIK. Bart ---------------------------------------------------------------------- PascalDragon · 2021-10-06 11:34 Quote from: 440bx on October 06, 2021, 08:59:25 amQuote from: Thaddy on October 06, 2021, 08:41:08 amChange the mode to {$mode delphi}. That should do the trick. (There may be a modeswitch for it too) Thank you Thaddy but, {$mode delphi} is something I really don't want to use.  I want my pchars to be pchars, not pwidechars (or panything else for that matter.) PChar only is an alias of PWideChar if modeswitch UnicodeStrings is set and that is by default only the case for mode DelphiUnicode. Quote from: 440bx on October 06, 2021, 08:59:25 amQuote from: PascalDragon on October 06, 2021, 08:46:44 amUse neither FPC nor ObjFPC mode as all other modes require the overload modifier. Thank you PascalDragon.  What mode should I use (including any modeswitches if necessary) to get the features of mode FPC and have the compiler require the use of the "overload" modifier ?  (please don't say "mode delphi".. ) Then I'll say nothing, cause that does not exist. ---------------------------------------------------------------------- 440bx · 2021-10-06 11:49 Quote from: PascalDragon on October 06, 2021, 01:34:55 pmPChar only is an alias of PWideChar if modeswitch UnicodeStrings is set and that is by default only the case for mode DelphiUnicode. I get lost in what the various compilers do with pchars these days.  I occasionally have the opportunity to use Delphi Seattle and it obviously treats the pchars in my programs as pwidechar because I get a bunch of Asian characters instead of ascii.  With FPC, I declare a pchar and so far, it's always a pchar... that's really nice. Quote from: PascalDragon on October 06, 2021, 08:46:44 amThen I'll say nothing, cause that does not exist. No problem.  I'll just live with not having the option of telling FPC to require the overload.  Much safer and predictable than setting modes I am unfamiliar with.  Thank you for the information and thank you to all those who contributed.