Re: [fpc-pascal] alloca

2022-05-15 Thread Steve Litt via fpc-pascal
Hairy Pixels via fpc-pascal said on Fri, 13 May 2022 22:43:15 +0700 >Is there an “alloca" like function in the RTL which allocates memory >from the stack? For example >https://man7.org/linux/man-pages/man3/alloca.3.html Why not just allocate from the heap? Everything I've seen tells me that if yo

Re: [fpc-pascal] Element type of set at compile time

2022-05-15 Thread Michael Van Canneyt via fpc-pascal
On Sun, 15 May 2022, Martin Frb via fpc-pascal wrote: On 15/05/2022 15:07, Hairy Pixels via fpc-pascal wrote: var I: ElementType(TMySet); begin for i := low(TMySet) to high(TMySet) do ; type   TMySet = set of (one,two,three); var   I: low(TMySet) .. high(TMySet) ; begin   for i :

Re: [fpc-pascal] Element type of set at compile time

2022-05-15 Thread Martin Frb via fpc-pascal
On 15/05/2022 15:07, Hairy Pixels via fpc-pascal wrote: var I: ElementType(TMySet); begin for i := low(TMySet) to high(TMySet) do ; type   TMySet = set of (one,two,three); var   I: low(TMySet) .. high(TMySet) ; begin   for i := low(TMySet) to high(TMySet) do     ; __

Re: [fpc-pascal] Element type of set at compile time

2022-05-15 Thread Mattias Gaertner via fpc-pascal
On Sun, 15 May 2022 09:03:58 +0200 (CEST) Michael Van Canneyt via fpc-pascal wrote: > On Sun, 15 May 2022, Hairy Pixels via fpc-pascal wrote: > > > Is there a compiler intrinsic to get the element type of a set at > > compile time? So if you have “set of T” it should return T. > > I don't thi

Re: [fpc-pascal] Element type of set at compile time

2022-05-15 Thread Hairy Pixels via fpc-pascal
> On May 15, 2022, at 2:03 PM, Michael Van Canneyt via fpc-pascal > wrote: > > Type > TMySet = set of (one,two,three); > > The element type does not exist as a separate type. I mean if you had code like this T would be the anonymous enum (one,two,three). Maybe element is not the correct te

Re: [fpc-pascal] Element type of set at compile time

2022-05-15 Thread Michael Van Canneyt via fpc-pascal
On Sun, 15 May 2022, Hairy Pixels via fpc-pascal wrote: Is there a compiler intrinsic to get the element type of a set at compile time? So if you have “set of T” it should return T. I don't think you can make such an intrinsic. This type does not always exist, since you can define Type