Re: [fpc-pascal] Are record fields zeroed on declaration of a record?

2020-10-08 Thread Bo Berglund via fpc-pascal
On Thu, 8 Oct 2020 23:00:32 +0200 (CEST), Michael Van Canneyt via fpc-pascal wrote: > > >On Thu, 8 Oct 2020, Ryan Joseph via fpc-pascal wrote: > >> >> >>> On Oct 8, 2020, at 5:14 AM, gabor via fpc-pascal >>> wrote: >>> >>> You can define typed constant and assign it to variable. >>> >>> type

Re: [fpc-pascal] Adding file to string to the RTL

2020-10-08 Thread Ryan Joseph via fpc-pascal
> On Oct 8, 2020, at 3:01 PM, Michael Van Canneyt via fpc-pascal > wrote: > > Should be easy enough. Great, glad this is happening. Let me know if you want some help with these additions or if it's best for you to just blast through it on you own. Seems like you know what's best for the RTL

Re: [fpc-pascal] Adding file to string to the RTL

2020-10-08 Thread Michael Van Canneyt via fpc-pascal
On Thu, 8 Oct 2020, Ryan Joseph via fpc-pascal wrote: On Oct 6, 2020, at 2:12 AM, Michael Van Canneyt via fpc-pascal wrote: // Read raw content as bytes Function GetFileContents(Const aFileName : RawByteString) : TBytes; Function GetFileContents(Const aFileName : UnicodeString) : TBytes

Re: [fpc-pascal] Are record fields zeroed on declaration of a record?

2020-10-08 Thread Michael Van Canneyt via fpc-pascal
On Thu, 8 Oct 2020, Ryan Joseph via fpc-pascal wrote: On Oct 8, 2020, at 5:14 AM, gabor via fpc-pascal wrote: You can define typed constant and assign it to variable. type TMyRecord = record X, Y: Integer; S: String; end; const MYDEFREC: TMyRecord = (X: 1; Y: 2; S: 'ABC'); I

Re: [fpc-pascal] Adding file to string to the RTL

2020-10-08 Thread Ryan Joseph via fpc-pascal
> On Oct 6, 2020, at 2:12 AM, Michael Van Canneyt via fpc-pascal > wrote: > > // Read raw content as bytes > > Function GetFileContents(Const aFileName : RawByteString) : TBytes; > Function GetFileContents(Const aFileName : UnicodeString) : TBytes; > Function GetFileContents(Const aHandle : T

Re: [fpc-pascal] Are record fields zeroed on declaration of a record?

2020-10-08 Thread Ryan Joseph via fpc-pascal
> On Oct 8, 2020, at 5:14 AM, gabor via fpc-pascal > wrote: > > You can define typed constant and assign it to variable. > > type > TMyRecord = record >X, Y: Integer; >S: String; > end; > > const > MYDEFREC: TMyRecord = (X: 1; Y: 2; S: 'ABC'); I never understood why we can't init

Re: [fpc-pascal] uses in '' relative paths

2020-10-08 Thread Ryan Joseph via fpc-pascal
> On Oct 7, 2020, at 11:15 AM, Ryan Joseph wrote: > > Some interesting stuff here, thanks. Almost there but for some reason > Scanner.pas is not found even though it's in the same directory as > TOMLParser.pas. The compiler did find TOMLParser despite /sources not being > explicitly included

Re: [fpc-pascal] Are record fields zeroed on declaration of a record?

2020-10-08 Thread Bo Berglund via fpc-pascal
On Thu, 8 Oct 2020 13:04:43 +0200 (CEST), Michael Van Canneyt via fpc-pascal wrote: >> OK, >> is it possible to define the TMyRecord with default values so that >> when I do Default(TMyRecord) it will be non-zero defaults written >> instead of zeros? > >No. You will always need code for that. OK

Re: [fpc-pascal] uses in '' relative paths

2020-10-08 Thread Mattias Gaertner via fpc-pascal
On Thu, 8 Oct 2020 09:37:06 -0300 "Marcos Douglas B. Santos via fpc-pascal" wrote: >[...] > > > unit TOML; > > > interface > > > uses > > > TOMLParser in '/sources', > > > TOMLTypes in '/sources'; > > > > uses > > TOMLParser in 'sources/TOMLParser.pas', > > TOMLTypes in 'sources/TOMLTyp

Re: [fpc-pascal] uses in '' relative paths

2020-10-08 Thread Marcos Douglas B. Santos via fpc-pascal
On Wed, Oct 7, 2020 at 2:02 PM Mattias Gaertner via fpc-pascal wrote: > > On Wed, 7 Oct 2020 10:53:16 -0600 > Ryan Joseph via fpc-pascal wrote: > > > I'm trying "uses in" which I never knew existed before. > > > > The idea is that I provide a path to TOML.pas using -Fu then use the > > "in" synta

Re: [fpc-pascal] Are record fields zeroed on declaration of a record?

2020-10-08 Thread gabor via fpc-pascal
OK, is it possible to define the TMyRecord with default values so that when I do Default(TMyRecord) it will be non-zero defaults written instead of zeros? You can define typed constant and assign it to variable. type TMyRecord = record X, Y: Integer; S: String; end; const MYDEFRE

Re: [fpc-pascal] Are record fields zeroed on declaration of a record?

2020-10-08 Thread Michael Van Canneyt via fpc-pascal
On Thu, 8 Oct 2020, Bo Berglund via fpc-pascal wrote: On Thu, 8 Oct 2020 10:47:52 +0200 (CEST), Michael Van Canneyt via fpc-pascal wrote: On Thu, 8 Oct 2020, Bo Berglund via fpc-pascal wrote: I would like to know if data containers of type packed record are zeroed when the item is decla

Re: [fpc-pascal] Are record fields zeroed on declaration of a record?

2020-10-08 Thread Bo Berglund via fpc-pascal
On Thu, 8 Oct 2020 10:47:52 +0200 (CEST), Michael Van Canneyt via fpc-pascal wrote: > > >On Thu, 8 Oct 2020, Bo Berglund via fpc-pascal wrote: > >> I would like to know if data containers of type packed record are >> zeroed when the item is declared? >> >> type >> TMyRecord = packed record >>

Re: [fpc-pascal] Precedence of compiler switches/directives

2020-10-08 Thread Michael Van Canneyt via fpc-pascal
On Thu, 8 Oct 2020, Peter via fpc-pascal wrote: I'm curious about who wins, if switches/directives are set to different values in different places. They could be set in fpg.cfg Command line or Lazarus lpi Directives in the code. Is there some AND/OR logic, or is it a strict precedence order?

[fpc-pascal] Precedence of compiler switches/directives

2020-10-08 Thread Peter via fpc-pascal
I'm curious about who wins, if switches/directives are set to different values in different places. They could be set in fpg.cfg Command line or Lazarus lpi Directives in the code. Is there some AND/OR logic, or is it a strict precedence order? Is it the same for all switches? I can see for exam

Re: [fpc-pascal] Are record fields zeroed on declaration of a record?

2020-10-08 Thread Michael Van Canneyt via fpc-pascal
On Thu, 8 Oct 2020, Bo Berglund via fpc-pascal wrote: I would like to know if data containers of type packed record are zeroed when the item is declared? type TMyRecord = packed record AField1: byte; AField2: word; AField3: single; AField4: boolean; AField5: array[0..15] of Ca

[fpc-pascal] Are record fields zeroed on declaration of a record?

2020-10-08 Thread Bo Berglund via fpc-pascal
I would like to know if data containers of type packed record are zeroed when the item is declared? type TMyRecord = packed record AField1: byte; AField2: word; AField3: single; AField4: boolean; AField5: array[0..15] of Cardinal; end; procedure SomeProc; var myRec: TMyR