[fpc-pascal] Pre-allocated TFPGList or similar

2019-11-23 Thread Ryan Joseph via fpc-pascal
I need a pre-grown list which I can put (not insert!) items into at indexes without getting "List index out of bounds" errors. For example I want to start with a list that has 10 empty indexes: list := TList.Create(10); // 10 empty slots! list[5] := someItem; Is this possible using any list ty

Re: [fpc-pascal] Strange experience with TJsonConfig.Clear

2019-11-23 Thread Bart via fpc-pascal
On Sat, Nov 23, 2019 at 7:47 PM Bart wrote: As I was afraid: User error! Cfg.JSONOptions := Cfg.JSONOptions + [joIgnoreTrailingComma]; This forces a reload of the file (since Filename isn't empty at this point). (B.t.w. fpc trunk raise an error : An unhandled exception occurred at $00438A84: EJ

Re: [fpc-pascal] Strange experience with TJsonConfig.Clear

2019-11-23 Thread Michael Van Canneyt
On Sat, 23 Nov 2019, Bart via fpc-pascal wrote: Hi, I experienced some strange behaviour with TJSONConfig.Clear. I'm using fpc 3.0.4 32-bit on Win10-64. (While I do have fpc trunk as well, the program is a Lazaurs GUI program and I don't like using Lazarus (trunk) in combination with fpc trun

Re: [fpc-pascal] How to translate C macros which use stringification?

2019-11-23 Thread Ryan Joseph via fpc-pascal
> On Nov 23, 2019, at 2:47 AM, Gabor Boros wrote: > > Can I do the same thing with FPC in a simple way? I translate some C source > to FPC and try to follow the original code. 99% certain this can't be done. I don't even think there's RTTI for local variable names but I could be wrong. Rega

[fpc-pascal] Strange experience with TJsonConfig.Clear

2019-11-23 Thread Bart via fpc-pascal
Hi, I experienced some strange behaviour with TJSONConfig.Clear. I'm using fpc 3.0.4 32-bit on Win10-64. (While I do have fpc trunk as well, the program is a Lazaurs GUI program and I don't like using Lazarus (trunk) in combination with fpc trunk.) I have a TJSONConfig that I use to store address