Re: [fpc-pascal] Set limitations

2025-01-11 Thread Hairy Pixels via fpc-pascal
On Jan 11, 2025 at 8:17:33 PM, Hairy Pixels wrote: > I was curious, is there any practical limit on the size of a set (32 bits > and 256 values) and why they couldn’t be 64 bit or any other arbitrary > size? The floor seems to be 4 bytes too but why not allow smaller sizes to > save memory? Perh

Re: [fpc-pascal] Set limitations

2025-01-11 Thread Hairy Pixels via fpc-pascal
On Jan 11, 2025 at 10:53:36 PM, Sven Barth via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > Set are a minimum of 4 Byte by default cause that's how Delphi does them. > Ifets you want smaller sets then use the $PackSets directive as Martin had > written. > I did not know this existed. I

[fpc-pascal] Set limitations

2025-01-11 Thread Hairy Pixels via fpc-pascal
I was curious, is there any practical limit on the size of a set (32 bits and 256 values) and why they couldn’t be 64 bit or any other arbitrary size? The floor seems to be 4 bytes too but why not allow smaller sizes to save memory? Perhaps just a historical artifact but I was curious. Regards,

Re: [fpc-pascal] Sockets programming in Linux

2025-01-12 Thread Hairy Pixels via fpc-pascal
Here’s what ChatGPT says. It just used the UNIX sockets API so nothing different from what you’d see in C. Looks pretty much correct to me but I didn’t try to build it. program TCPClient; uses SysUtils, Sockets; const HOST = '127.0.0.1'; PORT = 12345; var ClientSocket: LongInt; Addres

Re: [fpc-pascal] Inlined functions from compiled units

2025-01-24 Thread Hairy Pixels via fpc-pascal
On Jan 24, 2025 at 5:46:40 PM, Marco van de Voort via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > Slightly different. LTO afaik requires multiple compiles where the later > build uses info from the earlier build. > > The FPC implementation inlines if the unit-with-function-to-be-inline

Re: [fpc-pascal] Inlined functions from compiled units

2025-01-24 Thread Hairy Pixels via fpc-pascal
On Jan 24, 2025 at 2:01:09 PM, Sven Barth via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > When a function has inlining enabled (either explicit with the inline > directive or implicit through AutoInline optimization) then in addition to > generating its code to the object file (for dir

[fpc-pascal] Inlined functions from compiled units

2025-01-23 Thread Hairy Pixels via fpc-pascal
Is the compiler actually able to inline functions which are used from a unit? When a unit is used it’s compiled to a .o file and linked so the compiler doesn’t have access to the source code anymore and thus can’t inline I would think. I write this because I’ve recently learned of link-time optimi

Re: [fpc-pascal] Fwd: What to do to get new users

2025-01-23 Thread Hairy Pixels via fpc-pascal
On Jan 24, 2025 at 2:10:53 AM, Santi via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > procedure foo() > var > s1: TStringList; > s2: TStringList; > s3: TStringList; > begin > s1:=TStringList.create; > try >s2:=TStringList.create; >try > s3:=TStringList.create; > t

Re: [fpc-pascal] Fwd: What to do to get new users

2025-01-23 Thread Hairy Pixels via fpc-pascal
On Jan 24, 2025 at 11:20:02 AM, Nikolay Nikolov via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > As you can see, it's more complicated and more error prone. You can > simplify it a little bit with goto, but it will never be better, compared > to try...finally > > ok, I’ve never used exc

Re: [fpc-pascal] Fwd: What to do to get new users

2025-01-23 Thread Hairy Pixels via fpc-pascal
On Jan 24, 2025 at 12:43:51 PM, Nikolay Nikolov via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > That's not what exceptions are meant to be used for, though. What you > describe is called a program "defect". When you encounter a "defect" in > your program, you terminate the program. The

Re: [fpc-pascal] Fwd: What to do to get new users

2025-01-23 Thread Hairy Pixels via fpc-pascal
On Jan 24, 2025 at 1:34:26 PM, Nikolay Nikolov via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > Doesn't matter whether they're handled in the same scope or not. It's the > same code. Usually they're not handled in the same scope, but in a very > distant place. That's usually when except

Re: [fpc-pascal] Inlined functions from compiled units

2025-01-24 Thread Hairy Pixels via fpc-pascal
Since I’m topic on inlines. FPC always inlines even with debug flags and makes certain files impossible to break on. Is there a way to disable that? I would expect inlining to be off so you can could debug. I don’t have -Si on either which suggests it must be on to inline but I don’t see that happe

Re: [fpc-pascal] Fwd: What to do to get new users

2025-01-23 Thread Hairy Pixels via fpc-pascal
On Jan 24, 2025 at 8:38:25 AM, Nikolay Nikolov via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > Maybe because there's a much better way to write it: > > procedure foo(); > var > s1: TStringList = nil; > s2: TStringList = nil; > s3: TStringList = nil; > begin > try > s1:=TStr

[fpc-pascal] External library name

2025-01-04 Thread Hairy Pixels via fpc-pascal
I see this pattern in C translated header often but I’ve honestly never understood it entirely. Why does this “cDllName" need to be added to every single function which you could just use {$linklib }? Furthermore, I’m not even aware that it’s possible to tell the linker that you want to searc

Re: [fpc-pascal] External library name

2025-01-04 Thread Hairy Pixels via fpc-pascal
On Jan 5, 2025 at 11:53:36 AM, Adriaan van Os via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > This is a habit from the WIndows and Delphi world. In a one-levell > namespace on MacOS, the dll name > is superflouous. Note that ObjC symbols are always global ,which implies a > one-level n

Re: [fpc-pascal] External library name

2025-01-05 Thread Hairy Pixels via fpc-pascal
On Jan 5, 2025 at 4:43:39 PM, Jonas Maebe via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > That said, Darwin also uses two-level namespaces: > > https://blog.darlinghq.org/2018/07/mach-o-linking-and-loading-tricks.html#two-level-symbol-namespace > . However, it does not do this through

Re: [fpc-pascal] External library name

2025-01-05 Thread Hairy Pixels via fpc-pascal
On Jan 5, 2025 at 6:45:49 PM, Tomas Hajny wrote: > As you might have noticed, it's simply a more general solution allowing > to cover all target platforms supporting dynamic libraries in a more or > less equal way. Yeah if DLLs have their own namepace and $LINKLIB doesn’t propagate to all exte

Re: [fpc-pascal] Pascal sensitive diff tool?

2025-02-20 Thread Hairy Pixels via fpc-pascal
What do you mean? like syntax styling? I use Sublime Merge as my git client and it styles Pascal syntax. Regards, Ryan Joseph On Feb 21, 2025 at 2:05:03 AM, Peter B via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > Hi, > > I'm wondering if there is any diff tool out there, > that c

Re: [fpc-pascal] Feature "Multiline strings" added

2025-07-27 Thread Hairy Pixels via fpc-pascal
On Jul 27, 2025 at 11:01:16 AM, Michalis Kamburelis via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > I'd say that (while I understand the reasons it happened) having 2 > ways in the language to do the same thing -> makes things more > complicated. > > Why? > I originally liked the back

Re: [fpc-pascal] Feature "Multiline strings" added

2025-07-28 Thread Hairy Pixels via fpc-pascal
On Jul 28, 2025 at 8:24:38 AM, Brian via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > The two ways to do comments are, IMO, almost essential. The way I was > taught to write Pascal, about 45 years ago now, was to use braces for > comments - but then if you needed to comment out a whole

Re: [fpc-pascal] Feature "Multiline strings" added

2025-07-28 Thread Hairy Pixels via fpc-pascal
On Jul 28, 2025 at 9:12:53 AM, Michael Van Canneyt wrote: > Because the amount of whitespace to remove at the start of every line > is determined by the amount of spaces before the closing triple quotes. > > Ergo, you can only strip the whitespaces at the start of every line > after the whole st

Re: [fpc-pascal] Feature "Multiline strings" added

2025-07-28 Thread Hairy Pixels via fpc-pascal
On Jul 28, 2025 at 7:26:08 AM, Travis Siegel via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > Your argument makes no sense. There's always been multiple ways to do > many things in pascal, and it's never caused any more confusion than any > other typical language construct. > > Take fo

Re: [fpc-pascal] Feature "Multiline strings" added

2025-07-28 Thread Hairy Pixels via fpc-pascal
On Jul 28, 2025 at 1:04:49 AM, Michael Van Canneyt via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > Personally, I prefer the backtick solution. > The triple quote is slow, it requires postprocessing the string. > The backtick solution needs only one pass. > > > I positively HATE it whe

Re: [fpc-pascal] Feature "Multiline strings" added

2025-07-28 Thread Hairy Pixels via fpc-pascal
On Jul 28, 2025 at 10:13:20 AM, Martin Frb via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > Or have array element index done different? > type TFooArray = array (.0..9.) of Byte; > SomeFooArray(.3.) := 1; > > Oh wait, that compiles. ;) > never saw that before! so ugly too. Why do

<    1   2   3   4